X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=parsers.c;h=3197c4ff6644c77e7d9c89a78a9b13e29f06da01;hb=34635bf163b1b2860bbb0b6c9550b40196e5acd3;hp=f905c92a214315d629f5118b5da358313db3d375;hpb=9788f97d68076acffc11da82a9c65f06cd661b15;p=privoxy.git diff --git a/parsers.c b/parsers.c index f905c92a..3197c4ff 100644 --- a/parsers.c +++ b/parsers.c @@ -608,6 +608,14 @@ jb_err decompress_iob(struct client_state *csp) * XXX: this code is untested and should probably be removed. */ int skip_bytes; + + if (cur + 2 >= csp->iob->eod) + { + log_error(LOG_LEVEL_ERROR, + "gzip extra field flag set but insufficient data available."); + return JB_ERR_COMPRESS; + } + skip_bytes = *cur++; skip_bytes += (unsigned char)*cur++ << 8; @@ -634,14 +642,14 @@ jb_err decompress_iob(struct client_state *csp) if (flags & GZIP_FLAG_FILE_NAME) { /* A null-terminated string is supposed to follow. */ - while (*cur++ && (cur < csp->iob->eod)); + while ((cur < csp->iob->eod) && *cur++); } /* Skip the comment if necessary. */ if (flags & GZIP_FLAG_COMMENT) { /* A null-terminated string is supposed to follow. */ - while (*cur++ && (cur < csp->iob->eod)); + while ((cur < csp->iob->eod) && *cur++); } /* Skip the CRC if necessary. */