View | Details | Raw Unified | Return to bug 178710
Collapse All | Expand All

(-)plib/Makefile (-1 / +1 lines)
Lines 7-13 Link Here
7
7
8
PORTNAME=	plib
8
PORTNAME=	plib
9
PORTVERSION=	1.8.5
9
PORTVERSION=	1.8.5
10
PORTREVISION=	3
10
PORTREVISION=	4
11
CATEGORIES=	x11-toolkits
11
CATEGORIES=	x11-toolkits
12
MASTER_SITES=	http://plib.sourceforge.net/dist/
12
MASTER_SITES=	http://plib.sourceforge.net/dist/
13
13
(-)plib/files/patch-src-ssg-ssgParser.cxx (+60 lines)
Line 0 Link Here
1
Index: src/ssg/ssgParser.cxx
2
===================================================================
3
--- src/ssg/ssgParser.cxx.orig
4
+++ src/ssg/ssgParser.cxx
5
@@ -57,18 +57,18 @@ void _ssgParser::error( const char *form
6
   char msgbuff[ 255 ];
7
   va_list argp;
8
 
9
-  char* msgptr = msgbuff;
10
-  if (linenum)
11
-  {
12
-    msgptr += sprintf ( msgptr,"%s, line %d: ",
13
-      path, linenum );
14
-  }
15
-
16
   va_start( argp, format );
17
-  vsprintf( msgptr, format, argp );
18
+  vsnprintf( msgbuff, sizeof(msgbuff)-1, format, argp );
19
   va_end( argp );
20
+  
21
+  msgbuff[sizeof(msgbuff)-1] = '\0';
22
 
23
-  ulSetError ( UL_WARNING, "%s", msgbuff ) ;
24
+  if (linenum)
25
+  {
26
+    ulSetError ( UL_WARNING, "%s, line %d: %s", path, linenum, msgbuff ) ;
27
+  } else {
28
+    ulSetError ( UL_WARNING, "%s", msgbuff ) ;
29
+  }
30
 }
31
 
32
 
33
@@ -78,18 +78,18 @@ void _ssgParser::message( const char *fo
34
   char msgbuff[ 255 ];
35
   va_list argp;
36
 
37
-  char* msgptr = msgbuff;
38
-  if (linenum)
39
-  {
40
-    msgptr += sprintf ( msgptr,"%s, line %d: ",
41
-      path, linenum );
42
-  }
43
-
44
   va_start( argp, format );
45
-  vsprintf( msgptr, format, argp );
46
+  vsnprintf( msgbuff, sizeof(msgbuff)-1, format, argp );
47
   va_end( argp );
48
+  
49
+  msgbuff[sizeof(msgbuff)-1] = '\0';
50
 
51
-  ulSetError ( UL_DEBUG, "%s", msgbuff ) ;
52
+  if (linenum)
53
+  {
54
+    ulSetError ( UL_DEBUG, "%s, line %d: %s", path, linenum, msgbuff ) ;
55
+  } else {
56
+    ulSetError ( UL_DEBUG, "%s", msgbuff ) ;
57
+  }
58
 }
59
 
60
 // Opens the file and does a few internal calculations based on the spec.
(-)plib/files/patch-src-util-ulError.cxx (+18 lines)
Line 0 Link Here
1
Index: src/util/ulError.cxx
2
===================================================================
3
--- src/util/ulError.cxx.orig
4
+++ src/util/ulError.cxx
5
@@ -39,9 +39,11 @@ void ulSetError ( enum ulSeverity severi
6
 {
7
   va_list argp;
8
   va_start ( argp, fmt ) ;
9
-  vsprintf ( _ulErrorBuffer, fmt, argp ) ;
10
+  vsnprintf ( _ulErrorBuffer, sizeof(_ulErrorBuffer)-1, fmt, argp ) ;
11
   va_end ( argp ) ;
12
- 
13
+  
14
+  _ulErrorBuffer[sizeof(_ulErrorBuffer)-1] = '\0';
15
+
16
   if ( _ulErrorCB )
17
   {
18
     (*_ulErrorCB)( severity, _ulErrorBuffer ) ;

Return to bug 178710