use BLI_strnlen rather then strlen when comparing against fixed lengths.
[blender.git] / source / blender / editors / interface / interface_handlers.c
index 35aa351dc20d3fb827ab9b54f7ada213bec858c3..1e963e37fd23ce11dc5016c311153ee9c9d97949 100644 (file)
@@ -1316,10 +1316,11 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction
                } else {
                        if(select) {
                                /* make a selection, starting from the cursor position */
+                               int tlen;
                                but->selsta = but->pos;
                                
                                but->pos++;
-                               if(but->pos>strlen(str)) but->pos= strlen(str);
+                               if(but->pos > (tlen= strlen(str))) but->pos= tlen;
                                
                                but->selend = but->pos;
                        } else if(jump) {
@@ -1331,8 +1332,9 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction
                                        if(test_special_char(str[but->pos])) break;
                                }
                        } else {
+                               int tlen;
                                but->pos++;
-                               if(but->pos>strlen(str)) but->pos= strlen(str);
+                               if(but->pos > (tlen= strlen(str))) but->pos= tlen;
                        }
                }
        }