Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dist/pf/net Don't invoke UB.
details: https://anonhg.NetBSD.org/src/rev/780fb73a0237
branches: trunk
changeset: 359544:780fb73a0237
user: maya <maya%NetBSD.org@localhost>
date: Wed Feb 14 16:07:55 2018 +0000
description:
Don't invoke UB.
Heads up by John D. Baker.
diffstat:
sys/dist/pf/net/pf_table.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (35 lines):
diff -r 375cc2102712 -r 780fb73a0237 sys/dist/pf/net/pf_table.c
--- a/sys/dist/pf/net/pf_table.c Wed Feb 14 14:28:40 2018 +0000
+++ b/sys/dist/pf/net/pf_table.c Wed Feb 14 16:07:55 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pf_table.c,v 1.17 2011/05/11 12:22:34 hauke Exp $ */
+/* $NetBSD: pf_table.c,v 1.18 2018/02/14 16:07:55 maya Exp $ */
/* $OpenBSD: pf_table.c,v 1.70 2007/05/23 11:53:45 markus Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pf_table.c,v 1.17 2011/05/11 12:22:34 hauke Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf_table.c,v 1.18 2018/02/14 16:07:55 maya Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -984,14 +984,14 @@
if (af == AF_INET) {
sa->sin.sin_len = sizeof(sa->sin);
sa->sin.sin_family = AF_INET;
- sa->sin.sin_addr.s_addr = net ? htonl(-1 << (32-net)) : 0;
+ sa->sin.sin_addr.s_addr = net ? htonl(~0U << (32-net)) : 0;
} else if (af == AF_INET6) {
sa->sin6.sin6_len = sizeof(sa->sin6);
sa->sin6.sin6_family = AF_INET6;
for (i = 0; i < 4; i++) {
if (net <= 32) {
sa->sin6.sin6_addr.s6_addr32[i] =
- net ? htonl(-1 << (32-net)) : 0;
+ net ? htonl(~0U << (32-net)) : 0;
break;
}
sa->sin6.sin6_addr.s6_addr32[i] = 0xFFFFFFFF;
Home |
Main Index |
Thread Index |
Old Index