From nobody@FreeBSD.org  Tue Dec 20 12:15:13 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8CC63106568B
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 20 Dec 2011 12:15:13 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 98DD38FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 20 Dec 2011 12:15:11 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id pBKCFBx6058106
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 20 Dec 2011 12:15:11 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id pBKCFBR7058105;
	Tue, 20 Dec 2011 12:15:11 GMT
	(envelope-from nobody)
Message-Id: <201112201215.pBKCFBR7058105@red.freebsd.org>
Date: Tue, 20 Dec 2011 12:15:11 GMT
From: Andrei Lavreniyuk <andy.lavr@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [SECURITY] out of bounds access in _canonicalize devel/icu
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         163476
>Category:       ports
>Synopsis:       [SECURITY] out of bounds access in _canonicalize devel/icu
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    crees
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 20 12:20:11 UTC 2011
>Closed-Date:    Fri Dec 23 14:55:23 UTC 2011
>Last-Modified:  Fri Dec 23 15:00:28 UTC 2011
>Originator:     Andrei Lavreniyuk
>Release:        FreeBSD 8.2-STABLE
>Organization:
Technica-03, Inc.
>Environment:
FreeBSD datacenter.technica-03.local 8.2-STABLE FreeBSD 8.2-STABLE #0: Tue Dec 13 13:03:09 EET 2011     root@datacenter.technica-03.local:/usr/obj/usr/src/sys/SMP64  amd64
>Description:

http://bugs.icu-project.org/trac/ticket/8984
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- common/uloc.cpp
+++ common/uloc.cpp
@@ -1797,7 +1797,7 @@
                 int32_t variantLen = _deleteVariant(variant, uprv_min(variantSize, (nameCapacity-len)), variantToCompare, n);
                 len -= variantLen;
                 if (variantLen > 0) {
-                    if (name[len-1] == '_') { /* delete trailing '_' */
+                    if (len > 0 && name[len-1] == '_') { /* delete trailing '_' */
                         --len;
                     }
                     addKeyword = VARIANT_MAP[j].keyword;
@@ -1805,7 +1805,7 @@
                     break;
                 }
             }
-            if (name[len-1] == '_') { /* delete trailing '_' */
+            if (len > 0 && len <= nameCapacity && name[len-1] == '_') { /* delete trailing '_' */
                 --len;
             }
         }


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->office 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Tue Dec 20 12:20:25 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=163476 
Responsible-Changed-From-To: office->crees 
Responsible-Changed-By: crees 
Responsible-Changed-When: Thu Dec 22 21:29:19 UTC 2011 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=163476 
State-Changed-From-To: open->closed 
State-Changed-By: crees 
State-Changed-When: Fri Dec 23 14:55:22 UTC 2011 
State-Changed-Why:  
Committed. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/163476: commit references a PR
Date: Fri, 23 Dec 2011 14:54:32 +0000 (UTC)

 crees       2011-12-23 14:54:18 UTC
 
   FreeBSD ports repository
 
   Modified files:
     devel/icu            Makefile 
   Added files:
     devel/icu/files      patch-common-uloc.c 
   Log:
   Fix potential out of bounds access in _canonicalize devel/icu
   
   Not sure this is worth a VuXML, but one will be made on request
   
   PR:             ports/163476
   Submitted by:   Andrei Lavreniyuk <andy.lavr@gmail.com>
   Obtained from:  http://bugs.icu-project.org/trac/ticket/8984
   
   Revision  Changes    Path
   1.49      +1 -0      ports/devel/icu/Makefile
   1.1       +26 -0     ports/devel/icu/files/patch-common-uloc.c (new)
 _______________________________________________
 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"
 
>Unformatted:
