commit 95c3aa1624f47d0cad8a77541ab876b3b078a243
parent 25b4d453d057a2048d8cb4671ae817c0812baed6
Author: nion@noname <unknown>
Date: Sun, 29 Jan 2006 18:49:06 +0100
segfault fix with gcc-2.95 thanks florolf for help
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ii.c b/ii.c
@@ -197,7 +197,8 @@ static size_t tokenize(char **result, size_t reslen, char *str, char delim)
} else
n++;
}
- result[i++] = p;
+ if(i<reslen)
+ result[i++] = p;
return i + 2; /* number of tokens */
}
@@ -329,7 +330,7 @@ static void proc_server_cmd(char *buf)
*p = 0;
argv[TOK_TEXT] = ++p;
}
- tokenize(&argv[TOK_CMD], TOK_LAST - TOK_CMD + 1, cmd, ' ');
+ tokenize(&argv[TOK_CMD], TOK_LAST - TOK_CMD, cmd, ' ');
if(!strncmp("PING", argv[TOK_CMD], 5)) {
snprintf(message, PIPE_BUF, "PONG %s\r\n", argv[TOK_TEXT]);