From 7b1875c2b606f017b74ee5e833b74db1ce8f0606 Mon Sep 17 00:00:00 2001 From: AfonsoCMSousa Date: Thu, 27 Feb 2025 13:17:43 +0000 Subject: [PATCH] Forgot the error handling "throw". --- src/server.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server.c b/src/server.c index b5dd55b..b70d67d 100644 --- a/src/server.c +++ b/src/server.c @@ -141,6 +141,10 @@ int main(void) { sendKEY = create(char); sendKEY = size(send, 256); + if (sendKEY == NULL) + { + throw(MEMORY_ALLOC_FAILURE); + } } catch (MEMORY_ALLOC_FAILURE) { @@ -148,11 +152,12 @@ int main(void) close(sockfd); return 1; } + end_try; decryptText(sendKEY, buffer); aux.ID = req.ID; - memccpy(aux.key, send, 0, 256); + memccpy(aux.key, sendKEY, 0, 256); aux.level = req.level; aux.type = req.type; send(connfd, &aux, sizeof(aux), 0);