Replaced strncat with manual copying

This commit is contained in:
Gerhard Rieger 2023-06-24 08:24:29 +02:00
parent c01722ac3e
commit 779473f667
2 changed files with 14 additions and 3 deletions

View file

@ -14,6 +14,8 @@ Coding:
Rearranged option group bits to only require 32 bits on older systems. Rearranged option group bits to only require 32 bits on older systems.
Make gcc happy, replace strncat with "manual" copying
####################### V 1.7.4.5 (not released): ####################### V 1.7.4.5 (not released):
Corrections: Corrections:

View file

@ -192,9 +192,14 @@ char *sockaddr_info(const struct sockaddr *sa, socklen_t salen, char *buff, size
switch (sau->soa.sa_family) { switch (sau->soa.sa_family) {
#if WITH_UNIX #if WITH_UNIX
case 0: case 0:
case AF_UNIX: sockaddr_unix_info(&sau->un, salen, cp+1, blen-1); case AF_UNIX:
cp[0] = '"'; *cp++ = '"'; --blen;
strncat(cp+1, "\"", 1); sockaddr_unix_info(&sau->un, salen, cp, blen-1);
blen -= strlen(cp);
cp = strchr(cp, '\0');
*cp++ = '"'; --blen;
if (blen > 0)
*cp = '\0';
break; break;
#endif #endif
#if WITH_IP4 #if WITH_IP4
@ -513,12 +518,16 @@ int check_ipaddr(
const char *address) const char *address)
{ {
int res4, res6; int res4, res6;
#if WITH_IP4
if ((res4 = check_ip4addr(address)) == 0) { if ((res4 = check_ip4addr(address)) == 0) {
return 0; return 0;
} }
#endif
#if WITH_IP6
if ((res6 = check_ip6addr(address)) == 0) { if ((res6 = check_ip6addr(address)) == 0) {
return 0; return 0;
} }
#endif
return 1; return 1;
} }