Fixed ngx_parse_size() / ngx_parse_offset() with 0-length strings.

This commit is contained in:
Maxim Dounin 2017-02-17 17:01:27 +03:00
parent ff16c6f99c
commit 6183ca9ea8

View File

@ -17,6 +17,11 @@ ngx_parse_size(ngx_str_t *line)
ssize_t size, scale, max; ssize_t size, scale, max;
len = line->len; len = line->len;
if (len == 0) {
return NGX_ERROR;
}
unit = line->data[len - 1]; unit = line->data[len - 1];
switch (unit) { switch (unit) {
@ -58,6 +63,11 @@ ngx_parse_offset(ngx_str_t *line)
size_t len; size_t len;
len = line->len; len = line->len;
if (len == 0) {
return NGX_ERROR;
}
unit = line->data[len - 1]; unit = line->data[len - 1];
switch (unit) { switch (unit) {