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. |