sic

simple irc client
git clone git://git.suckless.org/sic
Log | Files | Refs | README | LICENSE

commit 44e0417e14c2f0a59c8688cdaf6b7d485ff7bdea
parent 148029905b9d0a06333cb43834eb819385561ab5
Author: Anselm R. Garbe <arg@suckless.org>
Date:   Thu, 11 Jan 2007 11:35:02 +0100

applied some segfault patches of Adrien Krunch Kunysz (thanks to Adrien!)
Diffstat:
Msic.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sic.c b/sic.c @@ -142,7 +142,8 @@ parsesrv(char *msg) { * <crlf> ::= CR LF */ if(msg[0] == ':') { /* check prefix */ - p = strchr(msg, ' '); + if (!(p = strchr(msg, ' '))) + return; *p = 0; for(++p; *p == ' '; p++); cmd = p; @@ -162,7 +163,7 @@ parsesrv(char *msg) { argv[Ttext] = ++p; } tokenize(&argv[Tcmd], Tlast - Tcmd, cmd, ' '); - if(!strncmp("PONG", argv[Tcmd], 5)) + if(!argv[Tcmd] || !strncmp("PONG", argv[Tcmd], 5)) return; else if(!strncmp("PING", argv[Tcmd], 5)) { snprintf(bufout, sizeof bufout, "PONG %s\r\n", argv[Ttext]);