misc/142339: Double free in getnetpath.c.

Henning Petersen henning.petersen at t-online.de
Tue Jan 5 08:00:07 UTC 2010


>Number:         142339
>Category:       misc
>Synopsis:       Double free in getnetpath.c.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 05 08:00:06 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Henning Petersen
>Release:        Freebsd-current
>Organization:
>Environment:
>Description:
np_sessionp is freed at line 102 and line 123.
>How-To-Repeat:

>Fix:
diff -u -r1.8 getnetpath.c
--- lib/libc/rpc/getnetpath.c	20 Sep 2007 22:35:24 -0000	1.8
+++ lib/libc/rpc/getnetpath.c	5 Jan 2010 05:52:21 -0000
@@ -101,7 +101,7 @@
     if ((np_sessionp->nc_handlep = setnetconfig()) == NULL) {
 	free(np_sessionp);
 	syslog (LOG_ERR, "rpc: failed to open " NETCONFIG);
-	goto failed;
+	return (NULL);
     }
     np_sessionp->valid = NP_VALID;
     np_sessionp->ncp_list = NULL;


Patch attached with submission follows:

Index: lib/libc/rpc/getnetpath.c
===================================================================
RCS file: /usr/ncvs/src/lib/libc/rpc/getnetpath.c,v
retrieving revision 1.8
diff -u -r1.8 getnetpath.c
--- lib/libc/rpc/getnetpath.c	20 Sep 2007 22:35:24 -0000	1.8
+++ lib/libc/rpc/getnetpath.c	5 Jan 2010 05:52:21 -0000
@@ -101,7 +101,7 @@
     if ((np_sessionp->nc_handlep = setnetconfig()) == NULL) {
 	free(np_sessionp);
 	syslog (LOG_ERR, "rpc: failed to open " NETCONFIG);
-	goto failed;
+	return (NULL);
     }
     np_sessionp->valid = NP_VALID;
     np_sessionp->ncp_list = NULL;


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list