bin/83419: [ PATCH ] incorrect malloc failures handling within libstand

Dan Lukes dan at kulesh.obluda.cz
Wed Jul 13 22:10:18 GMT 2005


>Number:         83419
>Category:       bin
>Synopsis:       [ PATCH ] incorrect malloc failures handling within libstand
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 13 22:10:17 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Dan Lukes
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
Obludarium
>Environment:
System: FreeBSD 5.4-STABLE #8: Sat Jul 9 16:31:08 CEST 2005 i386
lib/libstand/environment.c,v 1.6 2003/10/26 04:04:12 peter

>Description:
	Incorrect malloc failures handling within libstand environment
handling
>How-To-Repeat:
>Fix:

--- patch begins here ---
--- lib/libstand/environment.c.ORIG	Fri Nov 14 03:26:04 2003
+++ lib/libstand/environment.c	Wed Jul 13 23:57:38 2005
@@ -82,7 +82,13 @@
 	 * New variable; create and sort into list
 	 */
 	ev = malloc(sizeof(struct env_var));
+	if (ev == NULL)
+		return(-1);
 	ev->ev_name = strdup(name);
+	if (ev->name == NULL) {
+		freee(ev);
+		return(-1);
+	}
 	ev->ev_value = NULL;
 	/* hooks can only be set when the variable is instantiated */
 	ev->ev_sethook = sethook;
--- patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list