From dan@kulesh.obluda.cz  Wed Jul 13 07:22:59 2005
Return-Path: <dan@kulesh.obluda.cz>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id A89B116A41C
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 13 Jul 2005 07:22:59 +0000 (GMT)
	(envelope-from dan@kulesh.obluda.cz)
Received: from kulesh.obluda.cz (kulesh.obluda.cz [193.179.22.243])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 87EEB43D46
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 13 Jul 2005 07:22:58 +0000 (GMT)
	(envelope-from dan@kulesh.obluda.cz)
Received: from kulesh.obluda.cz (localhost.eunet.cz [127.0.0.1])
	by kulesh.obluda.cz (8.13.3/8.13.3) with ESMTP id j6D7MumC023062
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 13 Jul 2005 09:22:57 +0200 (CEST)
	(envelope-from dan@kulesh.obluda.cz)
Received: (from root@localhost)
	by kulesh.obluda.cz (8.13.3/8.13.1/Submit) id j6D7Mu0u023061;
	Wed, 13 Jul 2005 09:22:56 +0200 (CEST)
	(envelope-from dan)
Message-Id: <200507130722.j6D7Mu0u023061@kulesh.obluda.cz>
Date: Wed, 13 Jul 2005 09:22:56 +0200 (CEST)
From: Dan Lukes <dan@obluda.cz>
Reply-To: Dan Lukes <dan@obluda.cz>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [ PATCH ] incorrect handling of malloc failures within librpcsvc's xencrypt()/xdecrypt()
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         83369
>Category:       bin
>Synopsis:       [patch] incorrect handling of malloc failures within librpcsvc's xencrypt()/xdecrypt()
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    matteo
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 13 07:30:09 GMT 2005
>Closed-Date:    Mon Mar 31 11:03:14 UTC 2008
>Last-Modified:  Mon Mar 31 14:10:04 UTC 2008
>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/librpcsvc/xcrypt.c,v 1.4 2002/03/21 23:53:40 obrien
lib/librpcsvc/Makefile,v 1.16.8.2 2005/02/13 07:23:14 obrien

>Description:
	Incorrect handling of malloc failures within librpcsvc's xencrypt()/xdecrypt()
>How-To-Repeat:
>Fix:

--- patch begins here ---
--- lib/librpcsvc/xcrypt.c.ORIG	Mon Jul  1 22:53:53 2002
+++ lib/librpcsvc/xcrypt.c	Wed Jul 13 09:17:19 2005
@@ -63,7 +63,9 @@
 	int len;
 
 	len = strlen(secret) / 2;
-	buf = malloc((unsigned)len);
+	if ((buf = malloc((unsigned)len)) == NULL) {
+		return(0);
+	}
 
 	hex2bin(len, secret, buf);
 	passwd2des(passwd, key);
@@ -96,7 +98,9 @@
 	int len;
 
 	len = strlen(secret) / 2;
-	buf = malloc((unsigned)len);
+	if ((buf = malloc((unsigned)len)) == NULL) {
+		return(0);
+	}
 
 	hex2bin(len, secret, buf);
 	passwd2des(passwd, key);	
--- lib/librpcsvc/Makefile.ORIG	Mon Feb 14 12:33:34 2005
+++ lib/librpcsvc/Makefile	Wed Jul 13 09:19:51 2005
@@ -29,6 +29,8 @@
 
 NOMAN=
 
+WARNS+=	2
+
 .include <bsd.lib.mk>
 
 .SUFFIXES: .x _xdr.c
--- patch ends here ---
>Release-Note:
>Audit-Trail:

From: Dan Lukes <dan@obluda.cz>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/83369: [ PATCH ] incorrect handling of malloc failures within
 librpcsvc's xencrypt()/xdecrypt()
Date: Thu, 14 Jul 2005 16:42:32 +0200

 	Please note the 'WARNS+=2' change within Makefile should be 'WARNS?=2' 
 instead
 
Responsible-Changed-From-To: freebsd-bugs->matteo 
Responsible-Changed-By: matteo 
Responsible-Changed-When: Mon Sep 17 20:45:25 UTC 2007 
Responsible-Changed-Why:  
I'm working on RPC related programs, so this PR interests me. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=83369 
State-Changed-From-To: open->patched 
State-Changed-By: matteo 
State-Changed-When: Lun 4 Feb 2008 07:56:42 UTC 
State-Changed-Why:  
Fix committed to CURRENT, MFC coming in a week 

http://www.freebsd.org/cgi/query-pr.cgi?pr=83369 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/83369: commit references a PR
Date: Mon,  4 Feb 2008 07:56:44 +0000 (UTC)

 matteo      2008-02-04 07:56:36 UTC
 
   FreeBSD src repository
 
   Modified files:
     lib/librpcsvc        Makefile xcrypt.c 
   Log:
   Fix incorrect handling of malloc failures
   
   PR:             bin/83369
   MFC after:      1 week
   
   Revision  Changes    Path
   1.23      +2 -0      src/lib/librpcsvc/Makefile
   1.6       +6 -2      src/lib/librpcsvc/xcrypt.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/83369: commit references a PR
Date: Sun, 30 Mar 2008 19:57:29 +0000 (UTC)

 matteo      2008-03-30 19:57:23 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     lib/librpcsvc        xcrypt.c 
   Log:
   MFC rev. 1.6
           Fix incorrect handling of malloc failures
   
   PR:             bin/83369
   
   Revision  Changes    Path
   1.5.10.1  +6 -2      src/lib/librpcsvc/xcrypt.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: matteo 
State-Changed-When: Lun 31 Mar 2008 11:02:55 UTC 
State-Changed-Why:  
MFC'ed to RELENG_7 

http://www.freebsd.org/cgi/query-pr.cgi?pr=83369 

From: Dan Lukes <dan@obluda.cz>
To: matteo@FreeBSD.org, bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/83369: [patch] incorrect handling of malloc failures within
 librpcsvc's xencrypt()/xdecrypt()
Date: Mon, 31 Mar 2008 16:01:55 +0200

 > MFC'ed to RELENG_7
 
 	Thanks.
 
 	Please MFC them into RELENG_6 also - this version is not dead yet.
 
 	Thank you.
 
 						Dan
>Unformatted:
