libopkg: discard empty control file fields
[oweals/opkg-lede.git] / libopkg / parse_util.c
index fbecba6eb700954b811c6e09a712e02a00cee2f7..2aef7a9cce0544790a782f1266be946add44a3da 100644 (file)
@@ -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;
 }
 
 /*