From e598dcd139d8221f828d542ccf6f03466a5aecdc Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 10 Jun 2019 20:51:31 +0100 Subject: [PATCH] fix parsing of invalid syntax max-age value Cache-control header --- content/llcache.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/content/llcache.c b/content/llcache.c index 5aa8a9a29..c804b73a0 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -601,13 +601,18 @@ llcache_fetch_parse_cache_control(llcache_object *object, char *value) object->cache.no_cache = LLCACHE_VALIDATE_ALWAYS; } else if ((7 < comma - start) && strncasecmp(start, "max-age", 7) == 0) { + start += 7; /* skip max-age */ + /* Find '=' */ while (start < comma && *start != '=') { start++; } - /* Skip over it */ - start++; + if (start < comma) { + /* Skip over '=' */ + start++; + } + #define SKIP_ST(p) while (*p != '\0' && (*p == ' ' || *p == '\t')) p++ @@ -616,6 +621,7 @@ llcache_fetch_parse_cache_control(llcache_object *object, char *value) if (start < comma) { object->cache.max_age = atoi(start); + } }