From 4152dd8975b5ab3d7338325b56d2fa975ac0c4aa Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sun, 18 Sep 2011 20:15:37 +0200 Subject: waitress: fix invalid memory access --- src/libwaitress/waitress.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c index f993add..c360433 100644 --- a/src/libwaitress/waitress.c +++ b/src/libwaitress/waitress.c @@ -667,7 +667,7 @@ WaitressReturn_t WaitressFetchCall (WaitressHandle_t *waith) { hdrParseMode != HDRM_FINISHED) { /* make lines parseable by string routines */ *nextLine = '\0'; - if (*(nextLine-1) == '\r') { + if (nextLine-1 >= buf && *(nextLine-1) == '\r') { *(nextLine-1) = '\0'; } /* skip \0 */ @@ -725,7 +725,7 @@ WaitressReturn_t WaitressFetchCall (WaitressHandle_t *waith) { } /* end switch */ thisLine = nextLine; } /* end while strchr */ - memmove (buf, thisLine, thisLine-buf); + memmove (buf, thisLine, bufFilled-(thisLine-buf)); bufFilled -= (thisLine-buf); } /* end while hdrParseMode */ -- cgit v1.2.3