[systemd-devel] [PATCH] Correctly parse commented multiline variables
Michal Vyskocil
mvyskocil at suse.cz
Fri Feb 1 05:47:24 PST 2013
Buffer c must be freeed when code detects a comment or empty string after
a strip. Otherwise no other variable definitions will be loaded.
fixes: 565d91fdf
fixes: https://bugzilla.novell.com/show_bug.cgi?id=793411#c13
---
src/shared/util.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/shared/util.c b/src/shared/util.c
index 969ef2b..4a75996 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -815,11 +815,17 @@ int load_env_file(const char *fname,
p = strstrip(c ? c : l);
- if (!*p)
+ if (!*p) {
+ free(c);
+ c = NULL;
continue;
+ }
- if (strchr(COMMENTS, *p))
+ if (strchr(COMMENTS, *p)) {
+ free(c);
+ c = NULL;
continue;
+ }
u = normalize_env_assignment(p);
if (!u)
--
1.7.10.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20130201/c0cdfd8f/attachment.pgp>
More information about the systemd-devel
mailing list