diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-04-06 12:06:03 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-04-06 12:06:03 +0000 |
commit | a99e3765bec0d6cf29d640ecd0165b098895bf94 (patch) | |
tree | 63e7bbabef905c096dde2f5f601c60c26d214c33 /modutils/modprobe.c | |
parent | 5b08c79d8e0a76f54c5c8987d4c67a01b14a3c23 (diff) | |
download | busybox-w32-a99e3765bec0d6cf29d640ecd0165b098895bf94.tar.gz busybox-w32-a99e3765bec0d6cf29d640ecd0165b098895bf94.tar.bz2 busybox-w32-a99e3765bec0d6cf29d640ecd0165b098895bf94.zip |
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).
git-svn-id: svn://busybox.net/trunk/busybox@8700 69ca8d6d-28ef-0310-b511-8ec308f3f277
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 7078af220..df5d4bbd1 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
@@ -67,15 +67,17 @@ int parse_tag_value ( char *buffer, char **ptag, char **pvalue ) | |||
67 | buffer++; | 67 | buffer++; |
68 | tag = value = buffer; | 68 | tag = value = buffer; |
69 | while ( !isspace ( *value )) | 69 | while ( !isspace ( *value )) |
70 | value++; | 70 | if (!*value) return 0; |
71 | else value++; | ||
71 | *value++ = 0; | 72 | *value++ = 0; |
72 | while ( isspace ( *value )) | 73 | while ( isspace ( *value )) |
73 | value++; | 74 | value++; |
75 | if (!*value) return 0; | ||
74 | 76 | ||
75 | *ptag = tag; | 77 | *ptag = tag; |
76 | *pvalue = value; | 78 | *pvalue = value; |
77 | 79 | ||
78 | return bb_strlen( tag ) && bb_strlen( value ); | 80 | return 1; |
79 | } | 81 | } |
80 | 82 | ||
81 | /* Jump through hoops to simulate how fgets() grabs just one line at a | 83 | /* Jump through hoops to simulate how fgets() grabs just one line at a |