plib: fix CVE-2011-4620 CVE-2012-4552

This commit is contained in:
maxice8 2018-10-03 14:24:23 -03:00 committed by maxice8
parent a5adaf7c5d
commit feeead05d7
3 changed files with 73 additions and 7 deletions

View file

@ -0,0 +1,11 @@
--- src/util/ulError.cxx
+++ src/util/ulError.cxx
@@ -39,7 +39,7 @@
{
va_list argp;
va_start ( argp, fmt ) ;
- vsprintf ( _ulErrorBuffer, fmt, argp ) ;
+ vsnprintf ( _ulErrorBuffer, sizeof(_ulErrorBuffer), fmt, argp ) ;
va_end ( argp ) ;
if ( _ulErrorCB )

View file

@ -0,0 +1,55 @@
diff -up plib-1.8.5/src/ssg/ssgParser.cxx~ plib-1.8.5/src/ssg/ssgParser.cxx
--- src/ssg/ssgParser.cxx~ 2008-03-11 03:06:23.000000000 +0100
+++ src/ssg/ssgParser.cxx 2012-11-01 15:33:12.424483374 +0100
@@ -57,18 +57,16 @@ 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), format, argp );
va_end( argp );
- 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 +76,16 @@ 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), format, argp );
va_end( argp );
- 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.

View file

@ -1,16 +1,16 @@
# Template build file for 'plib'
# Template file for 'plib'
pkgname=plib
version=1.8.5
revision=5
build_style=gnu-configure
revision=6
configure_args="--enable-shared --disable-static"
build_style=gnu-configure
hostmakedepends="autoconf automake libtool"
makedepends="MesaLib-devel libX11-devel libXi-devel libXmu-devel"
short_desc="Suite of Portable Game Libraries"
maintainer="Enno Boland <gottox@voidlinux.eu>"
license="LGPL-2"
license="LGPL-2.0-or-later"
homepage="http://plib.sourceforge.net"
distfiles="http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz"
makedepends="MesaLib-devel libX11-devel libXi-devel libXmu-devel"
hostmakedepends="autoconf automake libtool"
distfiles="http://plib.sourceforge.net/dist/plib-${version}.tar.gz"
checksum=485b22bf6fdc0da067e34ead5e26f002b76326f6371e2ae006415dea6a380a32
pre_configure() {