obsdrdr.c: check errors of inet_ntop()

This commit is contained in:
Thomas Bernard 2023-12-29 23:59:28 +01:00
parent b16787cd5f
commit ee89fb5fa3
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF

View File

@ -1473,7 +1473,10 @@ update_portmapping(const char * ifname, unsigned short eport, int proto,
if (priv_delete_filter_rule(ifname, old_iport, proto, iaddr) < 0)
return -1;
inet_ntop(AF_INET, &iaddr, iaddr_str, sizeof(iaddr_str));
if (inet_ntop(AF_INET, &iaddr, iaddr_str, sizeof(iaddr_str)) == NULL) {
syslog(LOG_ERR, "inet_ntop(AF_INET, ...): %m");
return -1;
}
if(add_redirect_rule2(ifname, rhost, eport, iaddr_str, iport, proto,
desc, timestamp) < 0)
@ -1508,7 +1511,10 @@ update_portmapping_desc_timestamp(const char * ifname,
if (priv_delete_filter_rule(ifname, iport, proto, iaddr) < 0)
return -1;
inet_ntop(AF_INET, &iaddr, iaddr_str, sizeof(iaddr_str));
if (inet_ntop(AF_INET, &iaddr, iaddr_str, sizeof(iaddr_str)) == NULL) {
syslog(LOG_ERR, "inet_ntop(AF_INET, ...): %m");
return -1;
}
if(add_redirect_rule2(ifname, rhost, eport, iaddr_str, iport, proto,
desc, timestamp) < 0)