1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-25 21:07:40 +00:00
freebsd-ports/net/mopd/files/patch-pf-snit.c
David E. O'Brien 8f7ba5aeb3 String paranoia and security fixes from OpenBSD: prevent a remote buffer
overflow and remote syslog() exploits.

Obtained from:	OpenBSD
2000-08-29 00:49:08 +00:00

23 lines
646 B
C

--- otherOS/pf-snit.c 1996/09/21 19:12:50 1.2
+++ otherOS/pf-snit.c 2000/02/20 17:45:34 1.3
@@ -239,7 +239,8 @@
struct ifreq ifr;
int fd;
- strcpy(ifr.ifr_name, interface);
+ strncpy(ifr.ifr_name, interface, sizeof (ifr.ifr_name) -1);
+ ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = 0;
ifr.ifr_addr.sa_family = AF_UNSPEC;
bcopy(addr, ifr.ifr_addr.sa_data, 6);
@@ -274,7 +275,8 @@
struct ifreq ifr;
int fd;
- strcpy(ifr.ifr_name, interface);
+ strncpy(ifr.ifr_name, interface, sizeof (ifr.ifr_name) -1);
+ ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = 0;
ifr.ifr_addr.sa_family = AF_UNSPEC;
bcopy(addr, ifr.ifr_addr.sa_data, 6);