aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2007-06-13 23:09:25 +0000
committerChristian Grothoff <christian@grothoff.org>2007-06-13 23:09:25 +0000
commit6e12c7fae2b6350a65f1b2eeedafd6f05510726b (patch)
tree08a9904906bb81e36e454db6ceb28878bc18252f
parent7020eed03e0c270399c0a9087815cbbc93dda15f (diff)
downloadlibmicrohttpd-6e12c7fae2b6350a65f1b2eeedafd6f05510726b.tar.gz
libmicrohttpd-6e12c7fae2b6350a65f1b2eeedafd6f05510726b.zip
fix
-rw-r--r--src/daemon/session.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/daemon/session.c b/src/daemon/session.c
index 8854b94b..e3aa1241 100644
--- a/src/daemon/session.c
+++ b/src/daemon/session.c
@@ -158,6 +158,8 @@ MHD_get_next_header_line(struct MHD_Session * session) {
158 size_t pos; 158 size_t pos;
159 size_t start; 159 size_t start;
160 160
161 if (session->readLoc == 0)
162 return NULL;
161 start = 0; 163 start = 0;
162 pos = 0; 164 pos = 0;
163 rbuf = session->read_buffer; 165 rbuf = session->read_buffer;
@@ -189,11 +191,11 @@ MHD_get_next_header_line(struct MHD_Session * session) {
189 return NULL; 191 return NULL;
190 } 192 }
191 /* found, check if we have proper CRLF */ 193 /* found, check if we have proper CRLF */
192 rbuf = malloc(pos); 194 rbuf = malloc(pos + 1);
193 memcpy(rbuf, 195 memcpy(rbuf,
194 session->read_buffer, 196 session->read_buffer,
195 pos-1); 197 pos);
196 rbuf[pos-1] = '\0'; 198 rbuf[pos] = '\0';
197 if ( (session->read_buffer[pos] == '\r') && 199 if ( (session->read_buffer[pos] == '\r') &&
198 (session->read_buffer[pos+1] == '\n') ) 200 (session->read_buffer[pos+1] == '\n') )
199 pos++; /* skip both r and n */ 201 pos++; /* skip both r and n */