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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-08-30 14:07:50 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-08-30 14:07:50 +0400
commitb3704f45c4e165618e898b5b7d1a7391ad14dc50 (patch)
treeede24044252d222084cc59cef98e28ebfe8494c3 /source/blender/editors/space_nla
parent27ec8d5043f544685001aab3552b9b4b56bc1e1a (diff)
Fixes for snprintf usage:
* replace by BLI_snprintf in various places, note _snprintf on windows does not properly null terminate the string. * fix overflow in sequencer proxy code due to buffer being smaller than specified size. * fix some usage of snprintf as strcpy, this is will go wrong if the string contains % characters. * remove BLI_dynstr_printf function in gpu module, use BLI_dynstr_appendf
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r--source/blender/editors/space_nla/nla_draw.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 0583f328371..0c9c7877ddc 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -468,10 +468,10 @@ static void nla_draw_strip_text (AnimData *adt, NlaTrack *nlt, NlaStrip *strip,
/* just print the name and the range */
if (strip->flag & NLASTRIP_FLAG_TEMP_META) {
- sprintf(str, "%d) Temp-Meta", index);
+ BLI_snprintf(str, sizeof(str), "%d) Temp-Meta", index);
}
else {
- sprintf(str, strip->name);
+ BLI_strncpy(str, strip->name, sizeof(str));
}
/* set text color - if colors (see above) are light, draw black text, otherwise draw white */
@@ -514,7 +514,7 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V
{
const float ytol = 1.0f; /* small offset to vertical positioning of text, for legibility */
const char col[4] = {220, 220, 220, 255}; /* light grey */
- char str[16] = "";
+ char str[32] = "";
/* Always draw times above the strip, whereas sequencer drew below + above.
@@ -524,11 +524,11 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V
* while also preserving some accuracy, since we do use floats
*/
/* start frame */
- sprintf(str, "%.1f", strip->start);
+ BLI_snprintf(str, sizeof(str), "%.1f", strip->start);
UI_view2d_text_cache_add(v2d, strip->start-1.0f, ymaxc+ytol, str, col);
/* end frame */
- sprintf(str, "%.1f", strip->end);
+ BLI_snprintf(str, sizeof(str), "%.1f", strip->end);
UI_view2d_text_cache_add(v2d, strip->end, ymaxc+ytol, str, col);
}
@@ -730,9 +730,9 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
special = ICON_ACTION;
if (act)
- sprintf(name, "%s", act->id.name+2);
+ BLI_snprintf(name, sizeof(name), "%s", act->id.name+2);
else
- sprintf(name, "<No Action>");
+ BLI_strncpy(name, "<No Action>", sizeof(name));
// draw manually still
doDraw= 1;