nl = strrchr(script_cmd_buf, '\n');
if (nl) *nl = '\0';
- if ((cmd = (char*) malloc(strlen(script_cmd_buf))) != NULL)
+ if ((cmd = (char*) malloc(strlen(script_cmd_buf) + 1)) != NULL)
{
memset(cmd, 0, strlen(script_cmd_buf));
strcpy(cmd, script_cmd_buf);
}
int main(int argc, char* argv[]) {
+ srand(time(0));
if (argc < 2) {
printf("syntax: %s <port>\n\n",argv[0]);