initialize dest in cmd_add_string() to not segfault on empty strings
authorFelix Fietkau <nbd@openwrt.org>
Sat, 23 Feb 2013 18:30:01 +0000 (19:30 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 23 Feb 2013 18:30:01 +0000 (19:30 +0100)
hotplug-rule.c

index cb31c3f61301a2eb74c702ab9935989921ec078d..1f3189d6f849dc521ffb09b36065f0fe56d9fce5 100644 (file)
@@ -325,7 +325,7 @@ static void cmd_add_string(const char *pattern, struct blob_attr *msg)
        int len = 0;
        bool var = false;
 
-       blobmsg_alloc_string_buffer(&b, NULL, 1);
+       dest = blobmsg_alloc_string_buffer(&b, NULL, 1);
        str = alloca(strlen(pattern) + 1);
        strcpy(str, pattern);
        next = str;