Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/rpcgen Fix NULL pointer dereference



details:   https://anonhg.NetBSD.org/src/rev/767cb17ad3d7
branches:  trunk
changeset: 810764:767cb17ad3d7
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sun Sep 20 15:45:07 2015 +0000

description:
Fix NULL pointer dereference

After the last function improvements there is invalid plist dereference
at the beginning of the second for () external loop. Move the proper check
inside the internal secound for () loop, after plist reinitialization.

diffstat:

 usr.bin/rpcgen/rpc_hout.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r 615ed118bf4a -r 767cb17ad3d7 usr.bin/rpcgen/rpc_hout.c
--- a/usr.bin/rpcgen/rpc_hout.c Sun Sep 20 15:09:06 2015 +0000
+++ b/usr.bin/rpcgen/rpc_hout.c Sun Sep 20 15:45:07 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpc_hout.c,v 1.23 2015/05/09 23:12:57 dholland Exp $   */
+/*     $NetBSD: rpc_hout.c,v 1.24 2015/09/20 15:45:07 kamil Exp $      */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI";
 #else
-__RCSID("$NetBSD: rpc_hout.c,v 1.23 2015/05/09 23:12:57 dholland Exp $");
+__RCSID("$NetBSD: rpc_hout.c,v 1.24 2015/09/20 15:45:07 kamil Exp $");
 #endif
 #endif
 
@@ -193,10 +193,11 @@
        }
        did = 0;
        for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
-               if (!newstyle || plist->arg_num < 2) {
-                       continue;       /* old style or single args */
-               }
                for (plist = vers->procs; plist != NULL; plist = plist->next) {
+                       if (!newstyle || plist->arg_num < 2) {
+                               continue;       /* old style or single args */
+                       }
+
                        if (!did) {
                                cplusplusstart();
                                did = 1;



Home | Main Index | Thread Index | Old Index