From dennylin93@hs.ntnu.edu.tw  Fri May 17 11:15:24 2013
Return-Path: <dennylin93@hs.ntnu.edu.tw>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	by hub.freebsd.org (Postfix) with ESMTP id 1B8B553C
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 17 May 2013 11:15:24 +0000 (UTC)
	(envelope-from dennylin93@hs.ntnu.edu.tw)
Received: from mail.hs.ntnu.edu.tw (mail.hs.ntnu.edu.tw [140.131.149.3])
	by mx1.freebsd.org (Postfix) with ESMTP id AB7413D9
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 17 May 2013 11:15:23 +0000 (UTC)
Received: by mail.hs.ntnu.edu.tw (Postfix, from userid 1001)
	id 61E1E1C643D; Fri, 17 May 2013 19:15:15 +0800 (CST)
Message-Id: <20130517111515.61E1E1C643D@mail.hs.ntnu.edu.tw>
Date: Fri, 17 May 2013 19:15:15 +0800 (CST)
From: Denny Lin <dennylin93@hs.ntnu.edu.tw>
Reply-To: Denny Lin <dennylin93@hs.ntnu.edu.tw>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] x11-toolkits/plib: Patch vulnerabilities
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         178710
>Category:       ports
>Synopsis:       [PATCH] x11-toolkits/plib: Patch vulnerabilities
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 17 11:20:00 UTC 2013
>Closed-Date:    Sun May 19 14:06:46 UTC 2013
>Last-Modified:  Sun May 19 14:10:00 UTC 2013
>Originator:     Denny Lin
>Release:        FreeBSD 10.0-CURRENT amd64
>Organization:
>Environment:
System: FreeBSD cnmc32.hs.ntnu.edu.tw 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r228819M: Fri Dec 23 08:56:11 CST 2011 root@cnmc32.hs.ntnu.edu.tw:/usr/obj/usr/src/sys/GENERIC amd64


	
>Description:
Patches for CVE-2011-4620 and CVE-2012-4552. Obtained from https://build.opensuse.org/request/show/144547.
>How-To-Repeat:
	
>Fix:

	

--- plib.patch begins here ---
diff -ruN plib.orig/Makefile plib/Makefile
--- plib.orig/Makefile	2013-05-17 15:40:24.000000000 +0800
+++ plib/Makefile	2013-05-17 15:43:58.000000000 +0800
@@ -7,7 +7,7 @@
 
 PORTNAME=	plib
 PORTVERSION=	1.8.5
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	x11-toolkits
 MASTER_SITES=	http://plib.sourceforge.net/dist/
 
diff -ruN plib.orig/files/patch-src-ssg-ssgParser.cxx plib/files/patch-src-ssg-ssgParser.cxx
--- plib.orig/files/patch-src-ssg-ssgParser.cxx	1970-01-01 08:00:00.000000000 +0800
+++ plib/files/patch-src-ssg-ssgParser.cxx	2013-05-17 15:43:10.000000000 +0800
@@ -0,0 +1,60 @@
+Index: src/ssg/ssgParser.cxx
+===================================================================
+--- src/ssg/ssgParser.cxx.orig
++++ src/ssg/ssgParser.cxx
+@@ -57,18 +57,18 @@ void _ssgParser::error( const char *form
+   char msgbuff[ 255 ];
+   va_list argp;
+ 
+-  char* msgptr = msgbuff;
+-  if (linenum)
+-  {
+-    msgptr += sprintf ( msgptr,"%s, line %d: ",
+-      path, linenum );
+-  }
+-
+   va_start( argp, format );
+-  vsprintf( msgptr, format, argp );
++  vsnprintf( msgbuff, sizeof(msgbuff)-1, format, argp );
+   va_end( argp );
++  
++  msgbuff[sizeof(msgbuff)-1] = '\0';
+ 
+-  ulSetError ( UL_WARNING, "%s", msgbuff ) ;
++  if (linenum)
++  {
++    ulSetError ( UL_WARNING, "%s, line %d: %s", path, linenum, msgbuff ) ;
++  } else {
++    ulSetError ( UL_WARNING, "%s", msgbuff ) ;
++  }
+ }
+ 
+ 
+@@ -78,18 +78,18 @@ void _ssgParser::message( const char *fo
+   char msgbuff[ 255 ];
+   va_list argp;
+ 
+-  char* msgptr = msgbuff;
+-  if (linenum)
+-  {
+-    msgptr += sprintf ( msgptr,"%s, line %d: ",
+-      path, linenum );
+-  }
+-
+   va_start( argp, format );
+-  vsprintf( msgptr, format, argp );
++  vsnprintf( msgbuff, sizeof(msgbuff)-1, format, argp );
+   va_end( argp );
++  
++  msgbuff[sizeof(msgbuff)-1] = '\0';
+ 
+-  ulSetError ( UL_DEBUG, "%s", msgbuff ) ;
++  if (linenum)
++  {
++    ulSetError ( UL_DEBUG, "%s, line %d: %s", path, linenum, msgbuff ) ;
++  } else {
++    ulSetError ( UL_DEBUG, "%s", msgbuff ) ;
++  }
+ }
+ 
+ // Opens the file and does a few internal calculations based on the spec.
diff -ruN plib.orig/files/patch-src-util-ulError.cxx plib/files/patch-src-util-ulError.cxx
--- plib.orig/files/patch-src-util-ulError.cxx	1970-01-01 08:00:00.000000000 +0800
+++ plib/files/patch-src-util-ulError.cxx	2013-05-17 15:43:12.000000000 +0800
@@ -0,0 +1,18 @@
+Index: src/util/ulError.cxx
+===================================================================
+--- src/util/ulError.cxx.orig
++++ src/util/ulError.cxx
+@@ -39,9 +39,11 @@ void ulSetError ( enum ulSeverity severi
+ {
+   va_list argp;
+   va_start ( argp, fmt ) ;
+-  vsprintf ( _ulErrorBuffer, fmt, argp ) ;
++  vsnprintf ( _ulErrorBuffer, sizeof(_ulErrorBuffer)-1, fmt, argp ) ;
+   va_end ( argp ) ;
+- 
++  
++  _ulErrorBuffer[sizeof(_ulErrorBuffer)-1] = '\0';
++
+   if ( _ulErrorCB )
+   {
+     (*_ulErrorCB)( severity, _ulErrorBuffer ) ;
--- plib.patch ends here ---


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: rakuco 
State-Changed-When: Sun May 19 14:06:44 UTC 2013 
State-Changed-Why:  
Committed. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/178710: commit references a PR
Date: Sun, 19 May 2013 14:06:45 +0000 (UTC)

 Author: rakuco
 Date: Sun May 19 14:06:36 2013
 New Revision: 318524
 URL: http://svnweb.freebsd.org/changeset/ports/318524
 
 Log:
   Patch multiple vulnerabilities in x11-toolkits/plib.
   
   PR:		ports/178710
   Submitted by:	Denny Lin <dennylin93@hs.ntnu.edu.tw>
 
 Added:
   head/x11-toolkits/plib/files/patch-src-ssg-ssgParser.cxx   (contents, props changed)
   head/x11-toolkits/plib/files/patch-src-util-ulError.cxx   (contents, props changed)
 Modified:
   head/security/vuxml/vuln.xml
   head/x11-toolkits/plib/Makefile
 
 Modified: head/security/vuxml/vuln.xml
 ==============================================================================
 --- head/security/vuxml/vuln.xml	Sun May 19 13:37:05 2013	(r318523)
 +++ head/security/vuxml/vuln.xml	Sun May 19 14:06:36 2013	(r318524)
 @@ -51,6 +51,75 @@ Note:  Please add new entries to the beg
  
  -->
  <vuxml xmlns="http://www.vuxml.org/apps/vuxml-1">
 +  <vuln vid="c72a2494-c08b-11e2-bb21-083e8ed0f47b">
 +    <topic>plib -- stack-based buffer overflow</topic>
 +    <affects>
 +      <package>
 +	<name>plib</name>
 +	<range><lt>1.8.5_4</lt></range>
 +      </package>
 +    </affects>
 +    <description>
 +      <body xmlns="http://www.w3.org/1999/xhtml">
 +	<p>CVE reports:</p>
 +	<blockquote cite="https://cve.mitre.org/cgi-bin/cvename.cgi?name=2012-4552">
 +	  <p>Stack-based buffer overflow in the error function in
 +	  ssg/ssgParser.cxx in PLIB 1.8.5 allows remote attackers to
 +	  execute arbitrary code via a crafted 3d model file that
 +	  triggers a long error message, as demonstrated by a .ase
 +	  file.</p>
 +	</blockquote>
 +      </body>
 +    </description>
 +    <references>
 +      <bid>55839</bid>
 +      <cvename>CVE-2012-4552</cvename>
 +      <mlist>http://www.openwall.com/lists/oss-security/2012/10/29/8</mlist>
 +    </references>
 +    <dates>
 +      <discovery>2012-10-09</discovery>
 +      <entry>2013-05-19</entry>
 +    </dates>
 +  </vuln>
 +
 +  <vuln vid="13bf0602-c08a-11e2-bb21-083e8ed0f47b">
 +    <topic>plib -- buffer overflow</topic>
 +    <affects>
 +      <package>
 +	<name>plib</name>
 +	<range><lt>1.8.5_4</lt></range>
 +      </package>
 +    </affects>
 +    <description>
 +      <body xmlns="http://www.w3.org/1999/xhtml">
 +	<p>Secunia reports:</p>
 +	<blockquote cite="https://secunia.com/advisories/47297">
 +	  <p>A vulnerability has been discovered in PLIB, which can be
 +	  exploited by malicious people to compromise an application
 +	  using the library. The vulnerability is caused due to a
 +	  boundary error within the "ulSetError()" function
 +	  (src/util/ulError.cxx) when creating the error message,
 +	  which can be exploited to overflow a static buffer.</p>
 +	  <p>Successful exploitation allows the execution of arbitrary
 +	  code but requires that the attacker can e.g. control the
 +	  content of an overly long error message passed to the
 +	  "ulSetError()" function.</p>
 +	  <p>The vulnerability is confirmed in version 1.8.5. Other
 +	  versions may also be affected.</p>
 +	  <p>Originally reported in TORCS by Andres Gomez.</p>
 +	</blockquote>
 +      </body>
 +    </description>
 +    <references>
 +      <cvename>CVE-2011-4620</cvename>
 +      <mlist>http://openwall.com/lists/oss-security/2011/12/21/2</mlist>
 +    </references>
 +    <dates>
 +      <discovery>2011-12-21</discovery>
 +      <entry>2013-05-19</entry>
 +    </dates>
 +  </vuln>
 +
    <vuln vid="a8818f7f-9182-11e2-9bdf-d48564727302">
      <topic>optipng -- use-after-free vulnerability</topic>
      <affects>
 
 Modified: head/x11-toolkits/plib/Makefile
 ==============================================================================
 --- head/x11-toolkits/plib/Makefile	Sun May 19 13:37:05 2013	(r318523)
 +++ head/x11-toolkits/plib/Makefile	Sun May 19 14:06:36 2013	(r318524)
 @@ -7,7 +7,7 @@
  
  PORTNAME=	plib
  PORTVERSION=	1.8.5
 -PORTREVISION=	3
 +PORTREVISION=	4
  CATEGORIES=	x11-toolkits
  MASTER_SITES=	http://plib.sourceforge.net/dist/
  
 
 Added: head/x11-toolkits/plib/files/patch-src-ssg-ssgParser.cxx
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/x11-toolkits/plib/files/patch-src-ssg-ssgParser.cxx	Sun May 19 14:06:36 2013	(r318524)
 @@ -0,0 +1,60 @@
 +Index: src/ssg/ssgParser.cxx
 +===================================================================
 +--- src/ssg/ssgParser.cxx.orig
 ++++ src/ssg/ssgParser.cxx
 +@@ -57,18 +57,18 @@ void _ssgParser::error( const char *form
 +   char msgbuff[ 255 ];
 +   va_list argp;
 + 
 +-  char* msgptr = msgbuff;
 +-  if (linenum)
 +-  {
 +-    msgptr += sprintf ( msgptr,"%s, line %d: ",
 +-      path, linenum );
 +-  }
 +-
 +   va_start( argp, format );
 +-  vsprintf( msgptr, format, argp );
 ++  vsnprintf( msgbuff, sizeof(msgbuff)-1, format, argp );
 +   va_end( argp );
 ++  
 ++  msgbuff[sizeof(msgbuff)-1] = '\0';
 + 
 +-  ulSetError ( UL_WARNING, "%s", msgbuff ) ;
 ++  if (linenum)
 ++  {
 ++    ulSetError ( UL_WARNING, "%s, line %d: %s", path, linenum, msgbuff ) ;
 ++  } else {
 ++    ulSetError ( UL_WARNING, "%s", msgbuff ) ;
 ++  }
 + }
 + 
 + 
 +@@ -78,18 +78,18 @@ void _ssgParser::message( const char *fo
 +   char msgbuff[ 255 ];
 +   va_list argp;
 + 
 +-  char* msgptr = msgbuff;
 +-  if (linenum)
 +-  {
 +-    msgptr += sprintf ( msgptr,"%s, line %d: ",
 +-      path, linenum );
 +-  }
 +-
 +   va_start( argp, format );
 +-  vsprintf( msgptr, format, argp );
 ++  vsnprintf( msgbuff, sizeof(msgbuff)-1, format, argp );
 +   va_end( argp );
 ++  
 ++  msgbuff[sizeof(msgbuff)-1] = '\0';
 + 
 +-  ulSetError ( UL_DEBUG, "%s", msgbuff ) ;
 ++  if (linenum)
 ++  {
 ++    ulSetError ( UL_DEBUG, "%s, line %d: %s", path, linenum, msgbuff ) ;
 ++  } else {
 ++    ulSetError ( UL_DEBUG, "%s", msgbuff ) ;
 ++  }
 + }
 + 
 + // Opens the file and does a few internal calculations based on the spec.
 
 Added: head/x11-toolkits/plib/files/patch-src-util-ulError.cxx
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/x11-toolkits/plib/files/patch-src-util-ulError.cxx	Sun May 19 14:06:36 2013	(r318524)
 @@ -0,0 +1,18 @@
 +Index: src/util/ulError.cxx
 +===================================================================
 +--- src/util/ulError.cxx.orig
 ++++ src/util/ulError.cxx
 +@@ -39,9 +39,11 @@ void ulSetError ( enum ulSeverity severi
 + {
 +   va_list argp;
 +   va_start ( argp, fmt ) ;
 +-  vsprintf ( _ulErrorBuffer, fmt, argp ) ;
 ++  vsnprintf ( _ulErrorBuffer, sizeof(_ulErrorBuffer)-1, fmt, argp ) ;
 +   va_end ( argp ) ;
 +- 
 ++  
 ++  _ulErrorBuffer[sizeof(_ulErrorBuffer)-1] = '\0';
 ++
 +   if ( _ulErrorCB )
 +   {
 +     (*_ulErrorCB)( severity, _ulErrorBuffer ) ;
 _______________________________________________
 svn-ports-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-ports-all
 To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
 
>Unformatted:
