diff options
Diffstat (limited to 'apps/plugins/text_editor.c')
-rw-r--r-- | apps/plugins/text_editor.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index 75bbccf820..5397260c0d 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c | |||
@@ -115,18 +115,19 @@ int _do_action(int action, char* str, int line) | |||
115 | last_char_index = c; | 115 | last_char_index = c; |
116 | return 1; | 116 | return 1; |
117 | } | 117 | } |
118 | char *list_get_name_cb(int selected_item,void* data,char* buf) | 118 | char *list_get_name_cb(int selected_item, void* data, |
119 | char* buf, size_t buf_len) | ||
119 | { | 120 | { |
120 | char *b = &buffer[do_action(ACTION_GET,0,selected_item)]; | 121 | char *b = &buffer[do_action(ACTION_GET,0,selected_item)]; |
121 | (void)data; | 122 | (void)data; |
122 | if (rb->strlen(b) >= MAX_PATH) | 123 | if (rb->strlen(b) >= buf_len) |
123 | { | 124 | { |
124 | char t = b[MAX_PATH-10]; | 125 | char t = b[buf_len-10]; |
125 | b[MAX_PATH-10] = '\0'; | 126 | b[buf_len-10] = '\0'; |
126 | rb->snprintf(buf,MAX_PATH,"%s ...",b); | 127 | rb->snprintf(buf , buf_len, "%s ...", b); |
127 | b[MAX_PATH-10] = t; | 128 | b[buf_len-10] = t; |
128 | } | 129 | } |
129 | else rb->strcpy(buf,b); | 130 | else rb->strncpy(buf, b, buf_len); |
130 | return buf; | 131 | return buf; |
131 | } | 132 | } |
132 | char filename[MAX_PATH]; | 133 | char filename[MAX_PATH]; |