diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-12 17:25:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-12 17:25:54 +0300 |
commit | c8c86aa6a12a253680aa266ce1c5d51b1b39005a (patch) | |
tree | dfb97a6b2de546860e5c1aa1e701e735f0a666f6 /source/blender/editors/transform | |
parent | 6e47ffcc0d076596429b49cb283757b1952f7b86 (diff) |
- fix leak on STL loading if realloc fails.
- transform code was using sprintf reading and writing the same string (undefined behavior).
- softbody had unneeded NULL check.
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 394dd433060..43321802fc7 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2525,6 +2525,7 @@ void initResize(TransInfo *t) static void headerResize(TransInfo *t, float vec[3], char *str) { char tvec[60]; + char *spos= str; if (hasNumInput(&t->num)) { outputNumInput(&(t->num), tvec); } @@ -2537,24 +2538,27 @@ static void headerResize(TransInfo *t, float vec[3], char *str) { if (t->con.mode & CON_APPLY) { switch(t->num.idx_max) { case 0: - sprintf(str, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext); + spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext); break; case 1: - sprintf(str, "Scale: %s : %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext); + spos += sprintf(spos, "Scale: %s : %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext); break; case 2: - sprintf(str, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext); + spos += sprintf(spos, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext); } } else { if (t->flag & T_2D_EDIT) - sprintf(str, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext); + spos += sprintf(spos, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext); else - sprintf(str, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext); + spos += sprintf(spos, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext); } - if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) - sprintf(str, "%s Proportional size: %.2f", str, t->prop_size); + if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) { + spos += sprintf(spos, " Proportional size: %.2f", t->prop_size); + } + + (void)spos; } #define SIGN(a) (a<-FLT_EPSILON?1:a>FLT_EPSILON?2:3) |