CVS commit: src/usr.sbin/bootp/common

2021-05-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun May 30 02:28:35 UTC 2021

Modified Files:
src/usr.sbin/bootp/common: Makefile

Log Message:
address-of-packed-member warning is no longer a problem here.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/bootp/common/Makefile

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



CVS commit: src/usr.sbin/bootp/common

2021-05-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun May 30 02:28:35 UTC 2021

Modified Files:
src/usr.sbin/bootp/common: Makefile

Log Message:
address-of-packed-member warning is no longer a problem here.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/bootp/common/Makefile

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

Modified files:

Index: src/usr.sbin/bootp/common/Makefile
diff -u src/usr.sbin/bootp/common/Makefile:1.9 src/usr.sbin/bootp/common/Makefile:1.10
--- src/usr.sbin/bootp/common/Makefile:1.9	Sun Sep  6 07:20:31 2020
+++ src/usr.sbin/bootp/common/Makefile	Sun May 30 02:28:35 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2020/09/06 07:20:31 mrg Exp $
+#	$NetBSD: Makefile,v 1.10 2021/05/30 02:28:35 joerg Exp $
 
 LIBISPRIVATE=	yes
 
@@ -7,7 +7,6 @@ SRCS=	dovend.c dumptab.c getif.c hash.c 
 	report.c tzone.c
 CPPFLAGS+= -DETC_ETHERS -DSYSLOG -DDEBUG
 
-CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
 CWARNFLAGS.gcc+=	${GCC_NO_ADDR_OF_PACKED_MEMBER}
 
 .include 



CVS commit: src/usr.sbin/bootp/common

2017-01-11 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jan 11 12:18:22 UTC 2017

Modified Files:
src/usr.sbin/bootp/common: readfile.c

Log Message:
Avoid access to unaligned data.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/bootp/common/readfile.c

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

Modified files:

Index: src/usr.sbin/bootp/common/readfile.c
diff -u src/usr.sbin/bootp/common/readfile.c:1.19 src/usr.sbin/bootp/common/readfile.c:1.20
--- src/usr.sbin/bootp/common/readfile.c:1.19	Fri Oct  7 10:06:39 2011
+++ src/usr.sbin/bootp/common/readfile.c	Wed Jan 11 12:18:22 2017
@@ -22,7 +22,7 @@ SOFTWARE.
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: readfile.c,v 1.19 2011/10/07 10:06:39 joerg Exp $");
+__RCSID("$NetBSD: readfile.c,v 1.20 2017/01/11 12:18:22 joerg Exp $");
 #endif
 
 
@@ -1582,23 +1582,21 @@ makelower(char *s)
 PRIVATE struct in_addr_list *
 get_addresses(char **src)
 {
-	struct in_addr tmpaddrlist[MAXINADDRS];
-	struct in_addr *address1, *address2;
+	__aligned(4) struct in_addr tmpaddrlist[MAXINADDRS];
 	struct in_addr_list *result;
-	unsigned addrcount, totalsize;
+	unsigned addrcount, totalsize, address;
 
-	address1 = tmpaddrlist;
-	for (addrcount = 0; addrcount < MAXINADDRS; addrcount++) {
+	for (address = 0, addrcount = 0; addrcount < MAXINADDRS; addrcount++) {
 		while (isspace((unsigned char)**src) || (**src == ',')) {
 			(*src)++;
 		}
 		if (!**src) {			/* Quit if nothing more */
 			break;
 		}
-		if (prs_inetaddr(src, &(address1->s_addr)) < 0) {
+		if (prs_inetaddr(src, [address].s_addr) < 0) {
 			break;
 		}
-		address1++;/* Point to next address slot */
+		address++;/* Point to next address slot */
 	}
 	if (addrcount < 1) {
 		result = NULL;
@@ -1608,13 +1606,8 @@ get_addresses(char **src)
 		result = (struct in_addr_list *) smalloc(totalsize);
 		result->linkcount = 1;
 		result->addrcount = addrcount;
-		address1 = tmpaddrlist;
-		address2 = result->addr;
-		for (; addrcount > 0; addrcount--) {
-			address2->s_addr = address1->s_addr;
-			address1++;
-			address2++;
-		}
+		for (address = 0; address < addrcount; ++address)
+			result->addr[address] = tmpaddrlist[address];
 	}
 	return result;
 }



CVS commit: src/usr.sbin/bootp/common

2017-01-11 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jan 11 12:18:22 UTC 2017

Modified Files:
src/usr.sbin/bootp/common: readfile.c

Log Message:
Avoid access to unaligned data.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/bootp/common/readfile.c

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



CVS commit: src/usr.sbin/bootp/common

2011-10-07 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Oct  7 10:06:39 UTC 2011

Modified Files:
src/usr.sbin/bootp/common: readfile.c

Log Message:
Fix under-allocation-by-one


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/bootp/common/readfile.c

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

Modified files:

Index: src/usr.sbin/bootp/common/readfile.c
diff -u src/usr.sbin/bootp/common/readfile.c:1.18 src/usr.sbin/bootp/common/readfile.c:1.19
--- src/usr.sbin/bootp/common/readfile.c:1.18	Tue Jan  4 09:16:17 2011
+++ src/usr.sbin/bootp/common/readfile.c	Fri Oct  7 10:06:39 2011
@@ -22,7 +22,7 @@ SOFTWARE.
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: readfile.c,v 1.18 2011/01/04 09:16:17 wiz Exp $);
+__RCSID($NetBSD: readfile.c,v 1.19 2011/10/07 10:06:39 joerg Exp $);
 #endif
 
 
@@ -1208,9 +1208,9 @@ get_shared_string(char **src)
 	(void) get_string(src, retstring, length);
 
 	s = (struct shared_string *) smalloc(sizeof(struct shared_string) +
-	length);
+	length + 1);
 	s-linkcount = 1;
-	strlcpy(s-string, retstring, sizeof(retstring));
+	memcpy(s-string, retstring, length + 1);
 
 	return s;
 }



CVS commit: src/usr.sbin/bootp/common

2011-10-07 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Oct  7 10:06:39 UTC 2011

Modified Files:
src/usr.sbin/bootp/common: readfile.c

Log Message:
Fix under-allocation-by-one


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/bootp/common/readfile.c

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



CVS commit: src/usr.sbin/bootp/common

2011-01-04 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jan  4 09:16:18 UTC 2011

Modified Files:
src/usr.sbin/bootp/common: readfile.c

Log Message:
Add missing breaks in switch statement. Found by cppcheck.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/bootp/common/readfile.c

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

Modified files:

Index: src/usr.sbin/bootp/common/readfile.c
diff -u src/usr.sbin/bootp/common/readfile.c:1.17 src/usr.sbin/bootp/common/readfile.c:1.18
--- src/usr.sbin/bootp/common/readfile.c:1.17	Wed Apr 15 00:23:29 2009
+++ src/usr.sbin/bootp/common/readfile.c	Tue Jan  4 09:16:17 2011
@@ -22,7 +22,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: readfile.c,v 1.17 2009/04/15 00:23:29 lukem Exp $);
+__RCSID($NetBSD: readfile.c,v 1.18 2011/01/04 09:16:17 wiz Exp $);
 #endif
 
 
@@ -681,8 +681,10 @@
 			break;
 		case E_BAD_PATHNAME:
 			msg = bad pathname (need leading '/');
+			break;
 		case E_BAD_VALUE:
 			msg = bad value;
+			break;
 		default:
 			msg = unknown error;
 			break;



CVS commit: src/usr.sbin/bootp/common

2011-01-04 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jan  4 09:16:18 UTC 2011

Modified Files:
src/usr.sbin/bootp/common: readfile.c

Log Message:
Add missing breaks in switch statement. Found by cppcheck.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/bootp/common/readfile.c

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