mirror of
https://github.com/sheumann/hush.git
synced 2024-10-29 20:27:40 +00:00
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).
This commit is contained in:
parent
d298bd1d51
commit
7e496a71cf
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user