summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-23 04:32:43 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-23 04:32:43 +0100
commit4589f5bb0a973e9a41be93de06c87072cea4dfb9 (patch)
treec2df943c0370a9420a0dc59b2912a12acf4b2940
parent54b1da83ed8cadde4a53b541a48ce303ade862f7 (diff)
conf-parser: when we parse a string list, always fill in something
Some code really wants to know whether there was a string list parsed, so don't take the shortcut here, and always allocate a string list, even if it is an empty one. https://bugs.freedesktop.org/show_bug.cgi?id=62558
-rw-r--r--src/shared/conf-parser.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index b09e90ae8b..c2cf5a6a19 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -705,9 +705,18 @@ int config_parse_strv(
assert(data);
if (isempty(rvalue)) {
- /* Empty assignment resets the list */
+ char **empty;
+
+ /* Empty assignment resets the list. As a special rule
+ * we actually fill in a real empty array here rather
+ * than NULL, since some code wants to know if
+ * something was set at all... */
+ empty = strv_new(NULL, NULL);
+ if (!empty)
+ return log_oom();
+
strv_free(*sv);
- *sv = NULL;
+ *sv = empty;
return 0;
}