diff options
Diffstat (limited to 'ext/unicorn_http')
-rw-r--r-- | ext/unicorn_http/c_util.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/unicorn_http/c_util.h b/ext/unicorn_http/c_util.h index 8542b3d..ab1fc0e 100644 --- a/ext/unicorn_http/c_util.h +++ b/ext/unicorn_http/c_util.h @@ -108,8 +108,12 @@ static off_t parse_length(const char *value, size_t length) { off_t rv; - for (rv = 0; length-- && rv >= 0; ++value) - rv = step_incr(rv, *value, 10); + for (rv = 0; length-- && rv >= 0; ++value) { + if (*value >= '0' && *value <= '9') + rv = step_incr(rv, *value, 10); + else + return -1; + } return rv; } |