From: Fredrik Tolf Date: Thu, 6 Mar 2008 21:09:40 +0000 (+0100) Subject: Fixed a bug in hubread for fnet-dc. X-Git-Tag: 1.2~4^2~2 X-Git-Url: http://git.dolda2000.com/gitweb/?p=doldaconnect.git;a=commitdiff_plain;h=28a3ef5280f4533ae00590965639453bc5275dba Fixed a bug in hubread for fnet-dc. --- diff --git a/daemon/fnet-dc.c b/daemon/fnet-dc.c index 43820fc..593dc92 100644 --- a/daemon/fnet-dc.c +++ b/daemon/fnet-dc.c @@ -3014,7 +3014,7 @@ static void hubread(struct socket *sk, struct fnetnode *fn) free(newbuf); p = hub->inbuf; hub->inbufdata += datalen; - while((datalen > 0) && ((p2 = memchr(p, '|', datalen)) != NULL)) + while((p - hub->inbuf < hub->inbufdata) && ((p2 = memchr(p, '|', hub->inbufdata - (p - hub->inbuf))) != NULL)) { *(p2++) = 0; for(cmd = hubcmds; cmd->handler != NULL; cmd++) @@ -3025,7 +3025,6 @@ static void hubread(struct socket *sk, struct fnetnode *fn) } if((cmd->limit == 0) || (hub->queue.size < cmd->limit)) newqcmd(&hub->queue, p); - datalen -= p2 - p; p = p2; } memmove(hub->inbuf, p, hub->inbufdata -= p - hub->inbuf);