/*
* If PUT has Content-Length, we can forecast overquota
*/
- if ((lenhdr = apr_table_get(r->headers_in, "Content-Length")) &&
- (atol(lenhdr) > available_bytes)) {
- status = HTTP_INSUFFICIENT_STORAGE;
- *err = dav_new_error_tag(r->pool, status, 0, 0,
- msg, NULL, tag);
- goto out;
+ if (lenhdr = apr_table_get(r->headers_in, "Content-Length")) {
+ if (!ap_parse_strict_length(&size, lenhdr)) {
+ status = HTTP_BAD_REQUEST;
+ *err = dav_new_error(r->pool, status, 0, 0,
+ "client sent invalid Content-Length");
+ goto out;
+ }
+
+ if (size > available_bytes) {
+ status = HTTP_INSUFFICIENT_STORAGE;
+ *err = dav_new_error_tag(r->pool, status, 0, 0,
+ msg, NULL, tag);
+ goto out;
+ }
}
break;
case M_COPY: /* FALLTHROUGH */