mirror of
https://codeberg.org/scip/udpxd.git
synced 2025-12-16 11:30:57 +01:00
avoid sprintf NULL pointer
This commit is contained in:
2
host.c
2
host.c
@@ -95,7 +95,7 @@ host_t *get_host(char *ip, int port, struct sockaddr_in *v4, struct sockaddr_in6
|
|||||||
|
|
||||||
if(tmp->sin6_scope_id != 0) {
|
if(tmp->sin6_scope_id != 0) {
|
||||||
host->ip = malloc(INET6_ADDRSTRLEN + 9); /* plus [ % ] \0 , scope*/
|
host->ip = malloc(INET6_ADDRSTRLEN + 9); /* plus [ % ] \0 , scope*/
|
||||||
sprintf(host->ip, "[%s%%%d]", ip, tmp->sin6_scope_id);
|
sprintf(host->ip, "[%s%%%d]", myip, tmp->sin6_scope_id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
host->ip = malloc(INET6_ADDRSTRLEN + 3); /* plus [ ] \0 */
|
host->ip = malloc(INET6_ADDRSTRLEN + 3); /* plus [ ] \0 */
|
||||||
|
|||||||
Reference in New Issue
Block a user