From af03d64699f2c742d5430d2b7f249cbd13028749 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Fri, 31 Mar 2023 17:50:40 +0200 Subject: [PATCH] skipping send_to_all if invalid syntax was sent --- src/chat/misc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/chat/misc.c b/src/chat/misc.c index b9c281b..739b91d 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -146,6 +146,8 @@ void *send_to_all(void *json) //PARSE struct json_object *json_obj = json_tokener_parse((char*) json); + if (json_obj == NULL) return; //EXIT IF INVALID SYNTAX WAS SENT + do //SEND TO ALL CONNECTIONS { why2_send_socket(get_string_from_json(json_obj, "message"), get_string_from_json(json_obj, "username"), node_buffer -> connection); //SEND TO CLIENT