mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-03 03:52:38 +00:00
BUG/MINOR: cache: properly ignore unparsable max-age in quotes
When "max-age" or "s-maxage" receive their values in quotes, the pointer to the integer to be parsed is advanced by one, but the error pointer check doesn't consider this advanced offset, so it will not match a parse error such as max-age="a" and will take the value zero instead. This probably needs to be backported, though it's unsure it has any effect in the real world.
This commit is contained in:
parent
49b0482ed4
commit
1f38bdb3f6
@ -783,7 +783,7 @@ int http_calc_maxage(struct stream *s, struct cache *cache, int *true_maxage)
|
||||
chunk_memcat(chk, "", 1);
|
||||
offset = (*chk->area == '"') ? 1 : 0;
|
||||
smaxage = strtol(chk->area + offset, &endptr, 10);
|
||||
if (unlikely(smaxage < 0 || endptr == chk->area))
|
||||
if (unlikely(smaxage < 0 || endptr == chk->area + offset))
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -795,7 +795,7 @@ int http_calc_maxage(struct stream *s, struct cache *cache, int *true_maxage)
|
||||
chunk_memcat(chk, "", 1);
|
||||
offset = (*chk->area == '"') ? 1 : 0;
|
||||
maxage = strtol(chk->area + offset, &endptr, 10);
|
||||
if (unlikely(maxage < 0 || endptr == chk->area))
|
||||
if (unlikely(maxage < 0 || endptr == chk->area + offset))
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user