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-12-09 11:35:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-09 11:35:56 +0400
commit11aba526f28f22995c96d901f1a4a083e279a2f9 (patch)
tree3a19525c0c625d4109c18d05dff9cb40abd7cdfb /source/blender/blenkernel/intern/deform.c
parenta80a5c403474d281beb8cec1d58013d506c55b50 (diff)
another possible fix for bug [#29521], all callers of flip_side_name(...), assumed it initialized the string however for 1-2 length names it returned without doing anything.
in most cases the caller would then check if the name was different to see if the name was flipped, incorrectly comparing the uninitialized string with the original name.
Diffstat (limited to 'source/blender/blenkernel/intern/deform.c')
-rw-r--r--source/blender/blenkernel/intern/deform.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 8dfd7e25bfb..e5176663228 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -410,11 +410,15 @@ void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_
char number[MAX_VGROUP_NAME]= ""; /* The number extension string */
char *index=NULL;
- len= BLI_strnlen(from_name, MAX_VGROUP_NAME);
- if (len < 3) return; // we don't do names like .R or .L
-
+ /* always copy the name, since this can be called with an uninitialized string */
BLI_strncpy(name, from_name, MAX_VGROUP_NAME);
+ len= BLI_strnlen(from_name, MAX_VGROUP_NAME);
+ if (len < 3) {
+ /* we don't do names like .R or .L */
+ return;
+ }
+
/* We first check the case with a .### extension, let's find the last period */
if (isdigit(name[len-1])) {
index= strrchr(name, '.'); // last occurrence