From lichray@gmail.com  Wed Oct 24 01:35:45 2012
Return-Path: <lichray@gmail.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id DC90A9F2
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 24 Oct 2012 01:35:45 +0000 (UTC)
	(envelope-from lichray@gmail.com)
Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182])
	by mx1.freebsd.org (Postfix) with ESMTP id 9B8D08FC0A
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 24 Oct 2012 01:35:45 +0000 (UTC)
Received: by mail-ie0-f182.google.com with SMTP id k10so9914iea.13
        for <FreeBSD-gnats-submit@freebsd.org>; Tue, 23 Oct 2012 18:35:39 -0700 (PDT)
Received: by 10.50.179.36 with SMTP id dd4mr895852igc.64.1351042067108;
        Tue, 23 Oct 2012 18:27:47 -0700 (PDT)
Received: from localhost (mb25036d0.tmodns.net. [208.54.80.178])
        by mx.google.com with ESMTPS id vq4sm824754igb.10.2012.10.23.18.27.44
        (version=SSLv3 cipher=OTHER);
        Tue, 23 Oct 2012 18:27:46 -0700 (PDT)
Message-Id: <50874412.c49a320a.2c63.2c5e@mx.google.com>
Date: Tue, 23 Oct 2012 18:27:46 -0700 (PDT)
From: Zhihao Yuan <lichray@gmail.com>
Reply-To: Zhihao Yuan <lichray@gmail.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: catopen(3) uninitialized value in failed entries.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         173008
>Category:       kern
>Synopsis:       [libc] [patch] catopen(3) uninitialized value in failed entries.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    eadler
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 24 01:40:00 UTC 2012
>Closed-Date:    Mon Feb 04 00:37:59 UTC 2013
>Last-Modified:  Mon Feb 04 00:37:59 UTC 2013
>Originator:     Zhihao Yuan
>Release:        FreeBSD 8.3-STABLE amd64
>Organization:
Northern Illinois University
>Environment:
System: FreeBSD elitebook.hp 8.3-STABLE FreeBSD 8.3-STABLE #4 r240363: Tue Sep 11 10:40:15 CDT 2012 lichray@elitebook.hp:/usr/obj/usr/src/sys/HOUKAGO amd64


	
>Description:
	
	np->catd will be tested on line 340, but failed entries have uninitialized .catd.

	Invalid read under valgrind.

	BTW: Please take a look at standards/172805 also. I suggested some other changes relating to this module there.
>How-To-Repeat:
	
>Fix:

	

--- catclose_uinit.patch begins here ---
diff --git lib/libc/nls/msgcat.c lib/libc/nls/msgcat.c
index 44b1440..2859916 100644
--- lib/libc/nls/msgcat.c
+++ lib/libc/nls/msgcat.c
@@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$");
 				  if (np != NULL) {				\
 				  	np->name = strdup(n);			\
 					np->path = NULL;			\
+					np->catd = NLERR;			\
 					np->lang = (l == NULL) ? NULL :		\
 					    strdup(l);				\
 					np->caterrno = e;			\
--- catclose_uinit.patch ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->eadler 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Sun Nov 11 04:45:53 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173008 
State-Changed-From-To: open->analyzed 
State-Changed-By: eadler 
State-Changed-When: Sun Nov 11 04:56:54 UTC 2012 
State-Changed-Why:  
awaiting approval or review prior to commit (no action needed from 
submitter) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173008 
State-Changed-From-To: analyzed->patched 
State-Changed-By: eadler 
State-Changed-When: Mon Dec 17 13:15:09 UTC 2012 
State-Changed-Why:  
committed in HEAD 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173008 
State-Changed-From-To: patched->closed 
State-Changed-By: eadler 
State-Changed-When: Mon Feb 4 00:37:58 UTC 2013 
State-Changed-Why:  
I shall not MFC due to build failure 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173008 
>Unformatted:
