Source-Changes-HG archive

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

[src/trunk]: src/crypto/dist/ipsec-tools/src/setkey replace questionable poin...



details:   https://anonhg.NetBSD.org/src/rev/57e2ac7f3d2e
branches:  trunk
changeset: 765461:57e2ac7f3d2e
user:      drochner <drochner%NetBSD.org@localhost>
date:      Fri May 27 18:00:21 2011 +0000

description:
replace questionable pointer games which could cause reads of
uninitialized memory, from Wolfgang Stukenbrock per PR bin/44951

diffstat:

 crypto/dist/ipsec-tools/src/setkey/setkey.c |  19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diffs (47 lines):

diff -r 3b25e9ca7650 -r 57e2ac7f3d2e crypto/dist/ipsec-tools/src/setkey/setkey.c
--- a/crypto/dist/ipsec-tools/src/setkey/setkey.c       Fri May 27 17:50:41 2011 +0000
+++ b/crypto/dist/ipsec-tools/src/setkey/setkey.c       Fri May 27 18:00:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: setkey.c,v 1.14 2009/08/06 04:44:43 tteras Exp $       */
+/*     $NetBSD: setkey.c,v 1.15 2011/05/27 18:00:21 drochner Exp $     */
 
 /*     $KAME: setkey.c,v 1.36 2003/09/24 23:52:51 itojun Exp $ */
 
@@ -753,12 +753,6 @@
                        else
                                pfkey_sadump(msg);
                }
-               msg = (struct sadb_msg *)((caddr_t)msg +
-                                    PFKEY_UNUNIT64(msg->sadb_msg_len));
-               if (f_verbose) {
-                       kdebug_sadb((struct sadb_msg *)msg);
-                       printf("\n");
-               }
                break;
 
        case SADB_X_SPDGET:
@@ -773,13 +767,6 @@
                        pfkey_spdump_withports(msg);
                else
                        pfkey_spdump(msg);
-               if (msg->sadb_msg_seq == 0) break;
-               msg = (struct sadb_msg *)((caddr_t)msg +
-                                    PFKEY_UNUNIT64(msg->sadb_msg_len));
-               if (f_verbose) {
-                       kdebug_sadb((struct sadb_msg *)msg);
-                       printf("\n");
-               }
                break;
 #ifdef HAVE_PFKEY_POLICY_PRIORITY
        case SADB_X_SPDADD:
@@ -867,6 +854,10 @@
        while (p < ep) {
                msg = (struct sadb_msg *)p;
                len = PFKEY_UNUNIT64(msg->sadb_msg_len);
+               if (f_verbose) {
+                       kdebug_sadb((struct sadb_msg *)msg);
+                       printf("\n");
+               }
                postproc(msg, len);
                p += len;
        }



Home | Main Index | Thread Index | Old Index