summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cfg_parser.rl6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cfg_parser.rl b/src/cfg_parser.rl
index 07027f7..39836ab 100644
--- a/src/cfg_parser.rl
+++ b/src/cfg_parser.rl
@@ -86,10 +86,14 @@ static int owrt_string(char** dest, char* start, char* end)
return -1;
if(*dest) free(*dest);
- *dest = strndup(start, end - start);
+ int n = end - start;
+ *dest = malloc(n+1);
if(!(*dest))
return -2;
+ memcpy(*dest, start, n);
+ (*dest)[n] = 0;
+
return 0;
}