Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/routed Shuffle pointer magic to not depend on temporary...



details:   https://anonhg.NetBSD.org/src/rev/83955a1f6212
branches:  trunk
changeset: 348180:83955a1f6212
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri Oct 07 22:32:50 2016 +0000

description:
Shuffle pointer magic to not depend on temporary overaligned pointers
into a packed structure.

diffstat:

 sbin/routed/table.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r a0417b13f2e7 -r 83955a1f6212 sbin/routed/table.c
--- a/sbin/routed/table.c       Fri Oct 07 22:31:05 2016 +0000
+++ b/sbin/routed/table.c       Fri Oct 07 22:32:50 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: table.c,v 1.25 2016/04/04 07:37:07 ozaki-r Exp $       */
+/*     $NetBSD: table.c,v 1.26 2016/10/07 22:32:50 joerg Exp $ */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -36,7 +36,7 @@
 #include "defs.h"
 
 #ifdef __NetBSD__
-__RCSID("$NetBSD: table.c,v 1.25 2016/04/04 07:37:07 ozaki-r Exp $");
+__RCSID("$NetBSD: table.c,v 1.26 2016/10/07 22:32:50 joerg Exp $");
 #elif defined(__FreeBSD__)
 __RCSID("$FreeBSD$");
 #else
@@ -667,7 +667,7 @@
                ap->sin_len = 0;
                return;
        }
-       cp = (char *)(&ap->sin_addr.s_addr+1);
+       cp = (char *)&ap->sin_addr.s_addr + sizeof(ap->sin_addr.s_addr);
        while (*--cp == 0)
                continue;
        ap->sin_len = cp - (char*)ap + 1;



Home | Main Index | Thread Index | Old Index