projects
/
oweals
/
opkg-lede.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cd113c7
)
libopkg: discard empty control file fields
author
Jo-Philipp Wich
<jo@mein.io>
Fri, 10 Feb 2017 09:28:09 +0000
(10:28 +0100)
committer
Jo-Philipp Wich
<jo@mein.io>
Fri, 10 Feb 2017 09:28:09 +0000
(10:28 +0100)
If the resulting string is empty after whitespace trimming, free it and
store NULL instead of an empty string buffer.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
libopkg/parse_util.c
patch
|
blob
|
history
diff --git
a/libopkg/parse_util.c
b/libopkg/parse_util.c
index fbecba6eb700954b811c6e09a712e02a00cee2f7..2aef7a9cce0544790a782f1266be946add44a3da 100644
(file)
--- a/
libopkg/parse_util.c
+++ b/
libopkg/parse_util.c
@@
-35,7
+35,12
@@
is_field(const char *type, const char *line)
char *
parse_simple(const char *type, const char *line)
{
- return trim_xstrdup(line + strlen(type) + 1);
+ char *field = trim_xstrdup(line + strlen(type) + 1);
+ if (strlen(field) == 0) {
+ free(field);
+ return NULL;
+ }
+ return field;
}
/*