Browse Source

api - buffer size off by 1 for joined commands

Kano 12 years ago
parent
commit
5fdd5b5f55
1 changed files with 2 additions and 2 deletions
  1. 2 2
      api.c

+ 2 - 2
api.c

@@ -4226,8 +4226,8 @@ void api(int api_thr_id)
 				if (!did) {
 					if (strchr(cmd, CMDJOIN)) {
 						firstjoin = isjoin = true;
-						// cmd + leading '|' + '\0'
-						cmdsbuf = malloc(strlen(cmd) + 2);
+						// cmd + leading+tailing '|' + '\0'
+						cmdsbuf = malloc(strlen(cmd) + 3);
 						if (!cmdsbuf)
 							quithere(1, "OOM cmdsbuf");
 						strcpy(cmdsbuf, "|");