diff options
Diffstat (limited to 'source/blender/blenkernel/intern/idprop.c')
-rw-r--r-- | source/blender/blenkernel/intern/idprop.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 0596c5109dd..603ddf7ac2e 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -334,13 +334,12 @@ IDProperty *IDP_NewString(const char *st, const char *name, int maxlen) prop->len = 1; /* NULL string, has len of 1 to account for null byte. */ } else { - int stlen = strlen(st); + /* include null terminator '\0' */ + int stlen = strlen(st) + 1; if (maxlen > 0 && maxlen < stlen) stlen = maxlen; - stlen++; /* null terminator '\0' */ - prop->data.pointer = MEM_mallocN(stlen, "id property string 2"); prop->len = prop->totallen = stlen; BLI_strncpy(prop->data.pointer, st, stlen); |