Simplify checking filename component.

This commit is contained in:
Joris Vink 2016-01-08 21:19:37 +01:00
parent ce874f09ea
commit e580e6678e
1 changed files with 2 additions and 3 deletions

View File

@ -812,7 +812,7 @@ int
http_populate_multipart_form(struct http_request *req, int *v)
{
int h, i, c, l;
u_int32_t blen, slen, len;
u_int32_t blen, slen;
u_int8_t *s, *end, *e, *end_headers, *data;
char *d, *val, *type, *boundary, *fname;
char *headers[5], *args[5], *opt[5], *name;
@ -920,8 +920,7 @@ http_populate_multipart_form(struct http_request *req, int *v)
for (d = opt[2]; isspace(*d); d++)
;
len = MIN(strlen("filename="), strlen(d));
if (!strncasecmp(d, "filename=", len)) {
if (!strncasecmp(d, "filename=", 9)) {
if ((val = strchr(d, '=')) == NULL) {
kore_mem_free(name);
continue;