diff --git a/src/cli.c b/src/cli.c index 22d97b0..503d79b 100644 --- a/src/cli.c +++ b/src/cli.c @@ -69,7 +69,12 @@ void connectedCommunication(int sockfd) // Reading server answer read(sockfd, receiveBuff, sizeof(receiveBuff)); - printf("%s\n", receiveBuff); + // Detect null-string returned + if (receiveBuff[0] == 0) { + printLog("An error occured or invalid command!"); + } + + printf("%s\n\n", receiveBuff); } } diff --git a/src/server.c b/src/server.c index 1bf7a71..58fc334 100644 --- a/src/server.c +++ b/src/server.c @@ -76,7 +76,7 @@ static void serverCommunicationInstance(Server_t *args, int sockfd) } // Zeroing buffer - snprintf(sendBuff, SEND_BUFFER_SIZE, "%s", "Invalid command!"); + bzero(sendBuff, RECEIVE_BUFFER_SIZE); // Execute command by first arg in cmdList for (int i = 0; i < LEN(cmdList); i++) {