Skip to content

Commit 3e0db3a

Browse files
committed
ipc: Allocate enough size for nullcharacter
1 parent 4aaf2ca commit 3e0db3a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

target/common/test/ipc.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ IpcIface::IpcIface(int argc, char** argv) {
102102
char* tx = strtok(ipc_args, ",");
103103
char* rx = strtok(NULL, ",");
104104
// Store arguments persistently
105-
targs.tx = (char*)malloc(strlen(tx));
106-
targs.rx = (char*)malloc(strlen(rx));
105+
targs.tx = (char*)malloc(strlen(tx) + 1);
106+
targs.rx = (char*)malloc(strlen(rx) + 1);
107107
strcpy(targs.tx, tx);
108108
strcpy(targs.rx, rx);
109109
// Initialize IO thread which will handle TX, RX pipes

0 commit comments

Comments
 (0)