bugfix: allocate one more zero-byte to definitely get a zero-terminated string

next
Michael Stapelberg 2010-06-01 18:46:14 +02:00
parent de0c13ba78
commit 67a6bd5589
1 changed files with 2 additions and 1 deletions

View File

@ -112,8 +112,9 @@ void ipc_shutdown() {
IPC_HANDLER(command) {
/* To get a properly terminated buffer, we copy
* message_size bytes out of the buffer */
char *command = scalloc(message_size);
char *command = scalloc(message_size + 1);
strncpy(command, (const char*)message, message_size);
LOG("IPC: received: *%s*\n", command);
parse_cmd((const char*)command);
tree_render();
free(command);