From: Jeremy Kerr Date: Fri, 10 May 2013 04:01:06 +0000 (+0800) Subject: discover: Don't access bytes before the start of empty strings X-Git-Tag: v1.0.0~636 X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=07bf13167aacf49a694aea3341caa15379916bec discover: Don't access bytes before the start of empty strings Signed-off-by: Jeremy Kerr --- diff --git a/discover/parser-conf.c b/discover/parser-conf.c index 94612c3..4bd2387 100644 --- a/discover/parser-conf.c +++ b/discover/parser-conf.c @@ -46,6 +46,9 @@ char *conf_strip_str(char *s) if (!s) return NULL; + if (!strlen(s)) + return NULL; + while (*s == '"' || *s == '\'' || isspace(*s)) s++;