libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 6e12c7fae2b6350a65f1b2eeedafd6f05510726b
parent 7020eed03e0c270399c0a9087815cbbc93dda15f
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 13 Jun 2007 23:09:25 +0000

fix

Diffstat:
Msrc/daemon/session.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/daemon/session.c b/src/daemon/session.c @@ -158,6 +158,8 @@ MHD_get_next_header_line(struct MHD_Session * session) { size_t pos; size_t start; + if (session->readLoc == 0) + return NULL; start = 0; pos = 0; rbuf = session->read_buffer; @@ -189,11 +191,11 @@ MHD_get_next_header_line(struct MHD_Session * session) { return NULL; } /* found, check if we have proper CRLF */ - rbuf = malloc(pos); + rbuf = malloc(pos + 1); memcpy(rbuf, session->read_buffer, - pos-1); - rbuf[pos-1] = '\0'; + pos); + rbuf[pos] = '\0'; if ( (session->read_buffer[pos] == '\r') && (session->read_buffer[pos+1] == '\n') ) pos++; /* skip both r and n */