fix: cmd start with \n will terminate the server

This commit is contained in:
Renge 2022-05-05 14:08:52 -04:00
parent bcabef7925
commit f5e321c443

View File

@ -91,12 +91,12 @@ int pbx_get_next_command(FILE* f, char** str) {
return -3;
}
cmd[index++] = c;
if (c == '\r' || c == '\n')
cmd[index-1] = '\0';
if (c == '\n')
break;
if (c == '\r')
c = '\0';
cmd[index++] = c;
}
// command is empty