aboutsummaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorJack Miller <jack@codezen.org>2014-08-06 15:52:03 -0500
committerDavid Gibson <david@gibson.dropbear.id.au>2014-08-08 19:17:31 +1000
commit5d4a8b9c4c5145bd509bff20780270e00547c80a (patch)
tree9e0b277511b2a377ef10c2cb3f2de527875bac95 /data.c
parentf9e91a48ba509e77aadcb5349885e1777ef17372 (diff)
downloaddtc-5d4a8b9c4c5145bd509bff20780270e00547c80a.tar.gz
Properly handle embedded nul delimited string lists
For example: reserved-names="res1\0res2\0res3"; Where \0 is an actual embedded NUL in the source instead of a string escape. To achieve this, use the len given by the lexer instead of strlen. Without this patch dtc will mangle the output and possibly hang on realloc.
Diffstat (limited to 'data.c')
-rw-r--r--data.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/data.c b/data.c
index 4c50b12..8cae237 100644
--- a/data.c
+++ b/data.c
@@ -74,7 +74,7 @@ struct data data_copy_escape_string(const char *s, int len)
struct data d;
char *q;
- d = data_grow_for(empty_data, strlen(s)+1);
+ d = data_grow_for(empty_data, len + 1);
q = d.val;
while (i < len) {