check pointer before usage in new etag compare

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2995 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.36
Stefan Bühler 2015-07-05 20:19:17 +00:00
parent 9f05b61ab4
commit cfc88cf8f2
1 changed files with 2 additions and 1 deletions

View File

@ -20,7 +20,7 @@ int etag_is_equal(buffer *etag, const char *line, int weak_ok) {
} state = START;
const char *current;
const char *tok_start = etag->ptr;
const char *tok_start;
const char *tok = NULL;
int matched;
@ -29,6 +29,7 @@ int etag_is_equal(buffer *etag, const char *line, int weak_ok) {
}
if (!etag || buffer_string_is_empty(etag)) return 0;
tok_start = etag->ptr;
if ('W' == tok_start[0]) {
if (!weak_ok || '/' != tok_start[1]) return 0; /* bad etag */