diff options
author | Eric Andersen | 2004-04-06 12:06:03 +0000 |
---|---|---|
committer | Eric Andersen | 2004-04-06 12:06:03 +0000 |
commit | 7e496a71cfe54f192508427f9c8ea5be764952bd (patch) | |
tree | 63e7bbabef905c096dde2f5f601c60c26d214c33 /modutils/modprobe.c | |
parent | d298bd1d513ddf077c51df5f0dfb3a5b2d0c28ee (diff) | |
download | busybox-7e496a71cfe54f192508427f9c8ea5be764952bd.zip busybox-7e496a71cfe54f192508427f9c8ea5be764952bd.tar.gz |
Michael Tokarev, mjt at tls dot msk dot ru writes:
Fix parsing of all tag-value pairs (in modules.conf in particular).
Without this fix, code chokes badly on lines where either value or
both tag+value are missing, like bare
alias
line, or alias w/o the value like
alias some-module
(syntactically incorrect, but no need for coredumps either).
Diffstat (limited to 'modutils/modprobe.c')
-rw-r--r-- | modutils/modprobe.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index 7078af2..df5d4bb 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -67,15 +67,17 @@ int parse_tag_value ( char *buffer, char **ptag, char **pvalue ) buffer++; tag = value = buffer; while ( !isspace ( *value )) - value++; + if (!*value) return 0; + else value++; *value++ = 0; while ( isspace ( *value )) value++; + if (!*value) return 0; *ptag = tag; *pvalue = value; - return bb_strlen( tag ) && bb_strlen( value ); + return 1; } /* Jump through hoops to simulate how fgets() grabs just one line at a |