diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-09 21:03:44 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-09 21:03:44 +0300 |
commit | 1601f297c984fd437cb70cebf738bbda199b54f8 (patch) | |
tree | 116cb636dc79745083521dca3302583f0dc159e0 /source/blender/editors/interface/interface_handlers.c | |
parent | e68dff3e76f4f582aa6f90be567d5bd4b64435bf (diff) |
Fix #20245: datablock names allowed entering 22 characters but can
only accept 21.
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c7c0849927c..fe6635d60ab 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1079,9 +1079,9 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho uiStyleFontSet(&style->widget); - origstr= MEM_callocN(sizeof(char)*(data->maxlen+1), "ui_textedit origstr"); + origstr= MEM_callocN(sizeof(char)*data->maxlen, "ui_textedit origstr"); - BLI_strncpy(origstr, but->drawstr, data->maxlen+1); + BLI_strncpy(origstr, but->drawstr, data->maxlen); but->pos= strlen(origstr)-but->ofs; /* XXX solve generic */ @@ -1130,7 +1130,7 @@ static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char asc changed= ui_textedit_delete_selection(but, data); len= strlen(str); - if(len < data->maxlen) { + if(len+1 < data->maxlen) { for(x= data->maxlen; x>but->pos; x--) str[x]= str[x-1]; str[but->pos]= ascii; @@ -1365,7 +1365,7 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste for (y=0; y<strlen(buf); y++) { /* add contents of buffer */ - if(len < data->maxlen) { + if(len+1 < data->maxlen) { for(x= data->maxlen; x>but->pos; x--) str[x]= str[x-1]; str[but->pos]= buf[y]; @@ -1411,8 +1411,8 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) /* retrieve string */ data->maxlen= ui_get_but_string_max_length(but); - data->str= MEM_callocN(sizeof(char)*(data->maxlen+1), "textedit str"); - ui_get_but_string(but, data->str, data->maxlen+1); + data->str= MEM_callocN(sizeof(char)*data->maxlen, "textedit str"); + ui_get_but_string(but, data->str, data->maxlen); data->origstr= BLI_strdup(data->str); data->selextend= 0; |