From b7cf0c94979f9731ce6c3282a385f2d60c1668a8 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sat, 30 Sep 2017 00:16:15 +1000 Subject: [PATCH] more experimental work --- src/chat_system.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/chat_system.c b/src/chat_system.c index 539475d..3236701 100644 --- a/src/chat_system.c +++ b/src/chat_system.c @@ -146,6 +146,7 @@ void chat_system(struct user_record *user) { char *input_b; char *ptr; int z; + int y; if (sshBBS) { chat_in = STDIN_FILENO; @@ -265,12 +266,14 @@ void chat_system(struct user_record *user) { strcpy(readbuffer, partmessage); len = strlen(readbuffer); - + y = 0; for (z = 0;z < len; z++) { if (readbuffer[z] != '\n') { - message[z] = readbuffer[z]; - message[z+1] = '\0'; + message[y] = readbuffer[z]; + message[y+1] = '\0'; + y++; } else { + y = 0; // json parse jsmn_init(&parser); // we got some data from a client