coap_split_uri: Check if port number is in valid range

This change is made to resolve the failed URI parser test
t_parse_uri5()
This commit is contained in:
Olaf Bergmann committed 2015-03-09 18:01:34 +01:00
1 parent 3e99d6634e
commit 55c6efeca8
1 file changed
+6
+6
View File
@@ -133,6 +133,12 @@ coap_split_uri(unsigned char *str_var, size_t len, coap_uri_t *uri) {
while (p < q)
uri_port = uri_port * 10 + (*p++ - '0');
/* check if port number is in allowed range */
if (uri_port > 65535) {
res = -4;
goto error;
}
uri->port = uri_port;
}
}