From e657ca40e9ed685aa51f3ff956a7c8263c3bcd3e Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Fri, 3 Jun 2016 12:11:51 -0300 Subject: [PATCH] return error if host does not fit in host string --- core/net/http-socket/http-socket.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/net/http-socket/http-socket.c b/core/net/http-socket/http-socket.c index 1e5ebbb27..ddcebaec1 100644 --- a/core/net/http-socket/http-socket.c +++ b/core/net/http-socket/http-socket.c @@ -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. */ port = 80; if(*urlptr == ':') {