return error if host does not fit in host string

This commit is contained in:
Marco Casaroli 2016-06-03 12:11:51 -03:00
parent cade3c7699
commit e657ca40e9

View File

@ -349,6 +349,11 @@ parse_url(const char *url, char *host, uint16_t *portptr, char *path)
} }
} }
/* check if host is null terminated */
if (!memchr(host, 0, MAX_HOSTLEN)) {
return 0;
}
/* Find the port. Default is 80. */ /* Find the port. Default is 80. */
port = 80; port = 80;
if(*urlptr == ':') { if(*urlptr == ':') {