mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-20 12:55:43 +08:00
netlib_parseurl: Make the buffer size assumption explicit
This commit is contained in:

committed by
Petro Karashchenko

parent
a7de8dffe7
commit
f7b3eb5b44
@@ -63,6 +63,15 @@ int netlib_parseurl(FAR const char *str, FAR struct url_s *url)
|
|||||||
int ret = OK;
|
int ret = OK;
|
||||||
size_t pathlen;
|
size_t pathlen;
|
||||||
|
|
||||||
|
/* Each fields should have at least 1 byte to store
|
||||||
|
* the terminating NUL.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (url->schemelen == 0 || url->hostlen == 0 || url->pathlen == 0)
|
||||||
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* extract the protocol field, a set of a-z letters */
|
/* extract the protocol field, a set of a-z letters */
|
||||||
|
|
||||||
dest = url->scheme;
|
dest = url->scheme;
|
||||||
|
Reference in New Issue
Block a user