fec479ae4c
problem but is not used anywhere and will probably be removed from cfengine from maintainer William Yodlowsky <bsd at openbsd.rutgers.edu>
67 lines
2.2 KiB
Plaintext
67 lines
2.2 KiB
Plaintext
$OpenBSD: patch-src_ifconf_c,v 1.3 2005/10/27 21:47:28 sturm Exp $
|
|
--- src/ifconf.c.orig Thu Jun 30 04:36:09 2005
|
|
+++ src/ifconf.c Fri Oct 21 16:35:55 2005
|
|
@@ -113,7 +113,7 @@ if (vbroadcast[0] == '\0')
|
|
return;
|
|
}
|
|
|
|
-strcpy(IFR.ifr_name,vifdev);
|
|
+(void)strlcpy(IFR.ifr_name,vifdev,sizeof(IFR.ifr_name));
|
|
IFR.ifr_addr.sa_family = AF_INET;
|
|
|
|
if ((sk = socket(AF_INET,SOCK_DGRAM,IPPROTO_IP)) == -1)
|
|
@@ -129,7 +129,7 @@ if (ioctl(sk,SIOCGIFFLAGS, (caddr_t) &IF
|
|
}
|
|
|
|
flags = IFR.ifr_flags;
|
|
-strcpy(IFR.ifr_name,vifdev); /* copy this each time */
|
|
+(void)strlcpy(IFR.ifr_name,vifdev,sizeof(IFR.ifr_name)); /* copy this each time */
|
|
|
|
if (ioctl(sk,SIOCGIFMETRIC, (caddr_t) &IFR) == -1) /* Get the routing priority */
|
|
{
|
|
@@ -174,7 +174,7 @@ else
|
|
Verbose("Address given by nameserver: %s\n",inet_ntoa(inaddr));
|
|
}
|
|
|
|
-strcpy(IFR.ifr_name,vifdev);
|
|
+(void)strlcpy(IFR.ifr_name,vifdev,sizeof(IFR.ifr_name));
|
|
|
|
if (ioctl(sk,SIOCGIFADDR, (caddr_t) &IFR) == -1) /* Get the device status flags */
|
|
{
|
|
@@ -211,7 +211,7 @@ netmask.sin_addr = ((struct sockaddr_in
|
|
|
|
Verbose("Found netmask: %s\n",inet_ntoa(netmask.sin_addr));
|
|
|
|
-strcpy(VBUFF,inet_ntoa(netmask.sin_addr));
|
|
+(void)strlcpy(VBUFF,inet_ntoa(netmask.sin_addr),sizeof(VBUFF));
|
|
|
|
if (strcmp(VBUFF,vnetmask))
|
|
{
|
|
@@ -225,7 +225,7 @@ if (ioctl(sk,SIOCGIFBRDADDR, (caddr_t) &
|
|
}
|
|
|
|
sin = (struct sockaddr_in *) &IFR.ifr_addr;
|
|
-strcpy(VBUFF,inet_ntoa(sin->sin_addr));
|
|
+(void)strlcpy(VBUFF,inet_ntoa(sin->sin_addr),sizeof(VBUFF));
|
|
|
|
Verbose("Found broadcast address: %s\n",inet_ntoa(sin->sin_addr));
|
|
|
|
@@ -287,7 +287,7 @@ else
|
|
|
|
/* broadcast addr */
|
|
|
|
-strcpy(IFR.ifr_name,vifdev);
|
|
+(void)strlcpy(IFR.ifr_name,vifdev,sizeof(IFR.ifr_name));
|
|
broadcast.sin_addr.s_addr = inet_addr(VNUMBROADCAST);
|
|
IFR.ifr_addr = *((struct sockaddr *) &broadcast);
|
|
sin = (struct sockaddr_in *) &IFR.ifr_addr;
|
|
@@ -345,7 +345,7 @@ ba = broadcast / (256 * 256 * 256);
|
|
bb = (broadcast / (256 * 256)) % 256;
|
|
bc = broadcast / (256) % 256;
|
|
bd = broadcast % 256;
|
|
-sprintf(VNUMBROADCAST,"%u.%u.%u.%u",ba,bb,bc,bd);
|
|
+(void)snprintf(VNUMBROADCAST,sizeof(VNUMBROADCAST),"%u.%u.%u.%u",ba,bb,bc,bd);
|
|
}
|
|
|
|
/****************************************************************/
|