From e0e82d25708d43cfcf3b8343bedb89fc3a036900 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Fri, 31 Mar 2023 18:09:35 +0200 Subject: [PATCH] skipping read_socket_from_raw 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 739b91d..d6b1e79 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -220,6 +220,8 @@ char *read_socket_from_raw(char *raw) char *final_message; struct json_object *json_obj = json_tokener_parse(raw); + if (json_obj == NULL) return "ERR"; //RETURN IF INVALID SYNTAX WAS SENT BY SOME FUCKING SCRIPT KIDDIE + //GET STRINGS char *message = get_string_from_json(json_obj, "message"); //TODO: Check deallocation problems char *username = get_string_from_json(json_obj, "username");