mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 22:13:51 +00:00
http: fix memory leak and potential null pointer argument to strlen
This commit is contained in:
parent
2c7e7ac083
commit
0ecac5c8ff
@ -288,6 +288,9 @@ struct http_connection_t *net_http_connection_new(const char *url,
|
||||
else
|
||||
error = true;
|
||||
|
||||
if (string_is_empty(conn->scan))
|
||||
goto error;
|
||||
|
||||
/* Get the port here from the url if it's specified.
|
||||
does not work on username password urls: user:pass@domain.com
|
||||
|
||||
@ -312,12 +315,14 @@ struct http_connection_t *net_http_connection_new(const char *url,
|
||||
|
||||
strlcpy(new_domain, domain_port, sizeof(new_domain));
|
||||
|
||||
free(url_dup);
|
||||
|
||||
if (uri != NULL)
|
||||
{
|
||||
if (strchr(uri, (char) '/') == NULL)
|
||||
if (strchr(uri, (char) '/') == NULL)
|
||||
strlcat(new_domain, uri, sizeof(new_domain));
|
||||
else
|
||||
{
|
||||
{
|
||||
strlcat(new_domain, "/", sizeof(new_domain));
|
||||
strlcat(new_domain, strchr(uri, (char) '/')+sizeof(char), sizeof(new_domain));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user