diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2011-09-18 20:15:37 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2011-11-09 20:10:03 +0100 |
commit | 4152dd8975b5ab3d7338325b56d2fa975ac0c4aa (patch) | |
tree | 85fa9339d11afd55b64b595348e51fae60549a5a /src | |
parent | b094bd6dc48a3a0ef3dfd1e15e372af6a15b502f (diff) | |
download | pianobar-4152dd8975b5ab3d7338325b56d2fa975ac0c4aa.tar.gz pianobar-4152dd8975b5ab3d7338325b56d2fa975ac0c4aa.tar.bz2 pianobar-4152dd8975b5ab3d7338325b56d2fa975ac0c4aa.zip |
waitress: fix invalid memory access
Diffstat (limited to 'src')
-rw-r--r-- | src/libwaitress/waitress.c | 4 |
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 */ |