summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libwaitress/waitress.c4
1 files changed, 2 insertions, 2 deletions
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 */