* [PATCH] getsubopt: don't include leading = in value string
@ 2015-08-18 9:06 Steven Barth
2015-08-21 5:30 ` Rich Felker
0 siblings, 1 reply; 2+ messages in thread
From: Steven Barth @ 2015-08-18 9:06 UTC (permalink / raw)
To: musl; +Cc: Steven Barth
getsubopt incorrectly returns the delimiting = in the value string,
this patch fixes it by increasing the pointer position by one.
Signed-off-by: Steven Barth <cyrus@openwrt.org>
---
src/misc/getsubopt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/misc/getsubopt.c b/src/misc/getsubopt.c
index dac9bf9..53ee957 100644
--- a/src/misc/getsubopt.c
+++ b/src/misc/getsubopt.c
@@ -15,7 +15,7 @@ int getsubopt(char **opt, char *const *keys, char **val)
size_t l = strlen(keys[i]);
if (strncmp(keys[i], s, l)) continue;
if (s[l] == '=')
- *val = s + l;
+ *val = s + l + 1;
else if (s[l]) continue;
return i;
}
--
2.1.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] getsubopt: don't include leading = in value string
2015-08-18 9:06 [PATCH] getsubopt: don't include leading = in value string Steven Barth
@ 2015-08-21 5:30 ` Rich Felker
0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2015-08-21 5:30 UTC (permalink / raw)
To: musl
On Tue, Aug 18, 2015 at 11:06:04AM +0200, Steven Barth wrote:
> getsubopt incorrectly returns the delimiting = in the value string,
> this patch fixes it by increasing the pointer position by one.
>
> Signed-off-by: Steven Barth <cyrus@openwrt.org>
> ---
> src/misc/getsubopt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/misc/getsubopt.c b/src/misc/getsubopt.c
> index dac9bf9..53ee957 100644
> --- a/src/misc/getsubopt.c
> +++ b/src/misc/getsubopt.c
> @@ -15,7 +15,7 @@ int getsubopt(char **opt, char *const *keys, char **val)
> size_t l = strlen(keys[i]);
> if (strncmp(keys[i], s, l)) continue;
> if (s[l] == '=')
> - *val = s + l;
> + *val = s + l + 1;
> else if (s[l]) continue;
> return i;
> }
> --
Thanks! Applied.
Rich
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-21 5:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-18 9:06 [PATCH] getsubopt: don't include leading = in value string Steven Barth
2015-08-21 5:30 ` Rich Felker
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).