diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-15 15:04:29 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-15 15:04:29 +0400 |
commit | cc93e476abea344495e3288b1aa864c11935c608 (patch) | |
tree | 132df25e78db235f49d6e01839ee6f80730985e2 /source/blender/makesrna/intern/rna_access.c | |
parent | ea0253472209ab6009ea78209158e3c9bd30ba21 (diff) |
correct off by one error in previous commit, also add assert incase idproperty length gets out of sync.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 1c68e34791a..d3666e28338 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2275,11 +2275,11 @@ void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value) /* editing bytes is not 100% supported * since they can contain NIL chars */ if (idprop->subtype == IDP_STRING_SUB_BYTE) { - memcpy(value, IDP_String(idprop), idprop->len + 1); + memcpy(value, IDP_String(idprop), idprop->len); value[idprop->len]= '\0'; } else { - strcpy(value, IDP_String(idprop)); + memcpy(value, IDP_String(idprop), idprop->len); } } else if(sprop->get) { @@ -2336,6 +2336,10 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop) return idprop->len; } else { +#ifndef NDEBUG + /* these _must_ stay in sync */ + BLI_assert(strlen(IDP_String(idprop)) == idprop->len - 1); +#endif return idprop->len - 1; } } |