CVS commit: src/external/bsd/libpcap/dist

2023-08-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Aug 17 15:30:13 UTC 2023

Modified Files:
src/external/bsd/libpcap/dist: rpcap-protocol.c

Log Message:
include portability.h last because it re-defines macros otherwise


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/external/bsd/libpcap/dist/rpcap-protocol.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/libpcap/dist

2023-08-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Aug 17 15:30:13 UTC 2023

Modified Files:
src/external/bsd/libpcap/dist: rpcap-protocol.c

Log Message:
include portability.h last because it re-defines macros otherwise


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/external/bsd/libpcap/dist/rpcap-protocol.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libpcap/dist/rpcap-protocol.c
diff -u src/external/bsd/libpcap/dist/rpcap-protocol.c:1.1.1.2 src/external/bsd/libpcap/dist/rpcap-protocol.c:1.2
--- src/external/bsd/libpcap/dist/rpcap-protocol.c:1.1.1.2	Thu Aug 17 09:11:03 2023
+++ src/external/bsd/libpcap/dist/rpcap-protocol.c	Thu Aug 17 11:30:13 2023
@@ -40,10 +40,11 @@
 #include 		/* for functions with variable number of arguments */
 #include 		/* for the errno variable */
 #include "sockutils.h"
-#include "portability.h"
 #include "rpcap-protocol.h"
 #include 
 
+#include "portability.h"
+
 /*
  * This file contains functions used both by the rpcap client and the
  * rpcap daemon.



CVS commit: src/external/bsd/libpcap/dist

2019-10-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct 11 18:20:20 UTC 2019

Modified Files:
src/external/bsd/libpcap/dist: pcap-bpf.c

Log Message:
Fix the rest of the places where strncpy was called instead of pcap_strlcpy
to copy the interface name. The kernel requires the interface to be NUL
terminated anyway and will fail with ENAMETOOLONG otherwise. Pointed out
by Robert Swindells.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/libpcap/dist/pcap-bpf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libpcap/dist/pcap-bpf.c
diff -u src/external/bsd/libpcap/dist/pcap-bpf.c:1.9 src/external/bsd/libpcap/dist/pcap-bpf.c:1.10
--- src/external/bsd/libpcap/dist/pcap-bpf.c:1.9	Tue Oct  1 12:02:11 2019
+++ src/external/bsd/libpcap/dist/pcap-bpf.c	Fri Oct 11 14:20:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcap-bpf.c,v 1.9 2019/10/01 16:02:11 christos Exp $	*/
+/*	$NetBSD: pcap-bpf.c,v 1.10 2019/10/11 18:20:20 christos Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1995, 1996, 1998
@@ -22,7 +22,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pcap-bpf.c,v 1.9 2019/10/01 16:02:11 christos Exp $");
+__RCSID("$NetBSD: pcap-bpf.c,v 1.10 2019/10/11 18:20:20 christos Exp $");
 
 #ifdef HAVE_CONFIG_H
 #include 
@@ -628,7 +628,7 @@ bpf_open_and_bind(const char *name, char
 	/*
 	 * Now bind to the device.
 	 */
-	(void)strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+	pcap_strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
 	if (ioctl(fd, BIOCSETIF, (caddr_t)) < 0) {
 		switch (errno) {
 
@@ -835,7 +835,7 @@ pcap_can_set_rfmon_bpf(pcap_t *p)
 	/*
 	 * Now bind to the device.
 	 */
-	(void)strncpy(ifr.ifr_name, p->opt.device, sizeof(ifr.ifr_name));
+	pcap_strlcpy(ifr.ifr_name, p->opt.device, sizeof(ifr.ifr_name));
 	if (ioctl(fd, BIOCSETIF, (caddr_t)) < 0) {
 		switch (errno) {
 
@@ -1445,7 +1445,7 @@ pcap_cleanup_bpf(pcap_t *p)
 strerror(errno));
 			} else {
 memset(, 0, sizeof(req));
-strncpy(req.ifm_name, pb->device,
+pcap_strlcpy(req.ifm_name, pb->device,
 sizeof(req.ifm_name));
 if (ioctl(sock, SIOCGIFMEDIA, ) < 0) {
 	fprintf(stderr,
@@ -1459,7 +1459,7 @@ pcap_cleanup_bpf(pcap_t *p)
 		 * turn it off.
 		 */
 		memset(, 0, sizeof(ifr));
-		(void)strncpy(ifr.ifr_name,
+		pcap_strlcpy(ifr.ifr_name,
 		pb->device,
 		sizeof(ifr.ifr_name));
 		ifr.ifr_media =
@@ -2002,7 +2002,7 @@ pcap_activate_bpf(pcap_t *p)
 			status = PCAP_ERROR;
 			goto bad;
 		}
-		(void)strncpy(ifrname, p->opt.device, ifnamsiz);
+		pcap_strlcpy(ifrname, p->opt.device, ifnamsiz);
 		if (ioctl(fd, BIOCSETIF, (caddr_t)) < 0) {
 			pcap_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE,
 			errno, "BIOCSETIF: %s", p->opt.device);
@@ -2033,7 +2033,7 @@ pcap_activate_bpf(pcap_t *p)
 			/*
 			 * Now bind to the device.
 			 */
-			(void)strncpy(ifrname, p->opt.device, ifnamsiz);
+			pcap_strlcpy(ifrname, p->opt.device, ifnamsiz);
 #ifdef BIOCSETLIF
 			if (ioctl(fd, BIOCSETLIF, (caddr_t)) < 0)
 #else
@@ -2066,7 +2066,7 @@ pcap_activate_bpf(pcap_t *p)
  */
 (void) ioctl(fd, BIOCSBLEN, (caddr_t));
 
-(void)strncpy(ifrname, p->opt.device, ifnamsiz);
+pcap_strlcpy(ifrname, p->opt.device, ifnamsiz);
 #ifdef BIOCSETLIF
 if (ioctl(fd, BIOCSETLIF, (caddr_t)) >= 0)
 #else
@@ -2764,7 +2764,7 @@ get_if_flags(const char *name, bpf_u_int
 		return (-1);
 	}
 	memset(, 0, sizeof(req));
-	strncpy(req.ifm_name, name, sizeof(req.ifm_name));
+	pcap_strlcpy(req.ifm_name, name, sizeof(req.ifm_name));
 	if (ioctl(sock, SIOCGIFMEDIA, ) < 0) {
 		if (errno == EOPNOTSUPP || errno == EINVAL || errno == ENOTTY ||
 		errno == ENODEV || errno == EPERM) {
@@ -2891,7 +2891,7 @@ monitor_mode(pcap_t *p, int set)
 	}
 
 	memset(, 0, sizeof req);
-	strncpy(req.ifm_name, p->opt.device, sizeof req.ifm_name);
+	pcap_strlcpy(req.ifm_name, p->opt.device, sizeof(req.ifm_name));
 
 	/*
 	 * Find out how many media types we have.
@@ -3001,7 +3001,7 @@ monitor_mode(pcap_t *p, int set)
 return (PCAP_ERROR);
 			}
 			memset(, 0, sizeof(ifr));
-			(void)strncpy(ifr.ifr_name, p->opt.device,
+			pcap_strlcpy(ifr.ifr_name, p->opt.device,
 			sizeof(ifr.ifr_name));
 			ifr.ifr_media = req.ifm_current | IFM_IEEE80211_MONITOR;
 			if (ioctl(sock, SIOCSIFMEDIA, ) == -1) {



CVS commit: src/external/bsd/libpcap/dist

2019-10-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct 11 18:20:20 UTC 2019

Modified Files:
src/external/bsd/libpcap/dist: pcap-bpf.c

Log Message:
Fix the rest of the places where strncpy was called instead of pcap_strlcpy
to copy the interface name. The kernel requires the interface to be NUL
terminated anyway and will fail with ENAMETOOLONG otherwise. Pointed out
by Robert Swindells.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/libpcap/dist/pcap-bpf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.