Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-11-15 15:04:29 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-15 15:04:29 +0400
commitcc93e476abea344495e3288b1aa864c11935c608 (patch)
tree132df25e78db235f49d6e01839ee6f80730985e2 /source/blender/makesrna/intern/rna_access.c
parentea0253472209ab6009ea78209158e3c9bd30ba21 (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.c8
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;
}
}