diff options
Diffstat (limited to 'testing/toxic')
-rw-r--r-- | testing/toxic/prompt.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index 742b35f8..3006b8a6 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -44,12 +44,12 @@ static int prompt_buf_pos=0; | |||
44 | static void execute(ToxWindow* self, char* u_cmd) { | 44 | static void execute(ToxWindow* self, char* u_cmd) { |
45 | int i; | 45 | int i; |
46 | int newlines = 0; | 46 | int newlines = 0; |
47 | char cmd[256] = {0}; | 47 | char cmd[256] = {0}; |
48 | for(i = 0; i < strlen(prompt_buf); i++) | 48 | for(i = 0; i < strlen(prompt_buf); i++) |
49 | { | 49 | { |
50 | if (u_cmd[i] == '\n') | 50 | if (u_cmd[i] == '\n') |
51 | ++newlines; | 51 | ++newlines; |
52 | else | 52 | else |
53 | cmd[i - newlines] = u_cmd[i]; | 53 | cmd[i - newlines] = u_cmd[i]; |
54 | } | 54 | } |
55 | 55 | ||
@@ -276,7 +276,7 @@ static void execute(ToxWindow* self, char* u_cmd) { | |||
276 | static void prompt_onKey(ToxWindow* self, int key) { | 276 | static void prompt_onKey(ToxWindow* self, int key) { |
277 | // PRINTABLE characters: Add to line. | 277 | // PRINTABLE characters: Add to line. |
278 | if(isprint(key)) { | 278 | if(isprint(key)) { |
279 | if (prompt_buf_pos == 255){ | 279 | if (prompt_buf_pos == (sizeof(prompt_buf) - 1)){ |
280 | wprintw(self->window, "\nToo Long.\n"); | 280 | wprintw(self->window, "\nToo Long.\n"); |
281 | prompt_buf_pos = 0; | 281 | prompt_buf_pos = 0; |
282 | prompt_buf[0] = 0; | 282 | prompt_buf[0] = 0; |