File: 12-Use-vnsprintf.patch

package info (click to toggle)
super 3.30.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,860 kB
  • sloc: ansic: 24,673; sh: 297; makefile: 296
file content (34 lines) | stat: -rw-r--r-- 1,017 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From: Robert Luberda <robert@debian.org>
Date: Sun, 4 Dec 2011 16:56:57 +0100
Subject: 12 Use vnsprintf.

error.c: Use vsnprintf() instead of vprintf() to fix a crash
occurring when syslog logging is enabled and total length
of arguments passed to super is greater then 1300 characters.
rsyslog.c: Do the same just in case.
---
 error.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/error.c b/error.c
index c25db2d..1a2ae48 100644
--- a/error.c
+++ b/error.c
@@ -346,7 +346,7 @@ Error(
 	if (tag)
 	    StrLCat(newfmt, tag, sizeof(newfmt));
 	va_start(ap, fmt);
-	(void) vsprintf(buf, newfmt, ap);
+	(void) vsnprintf(buf, sizeof(buf), newfmt, ap);
 	va_end(ap);
 	if (show_perror)
 	    StrLCat(buf, Strerror(error), sizeof(buf));
@@ -515,7 +515,7 @@ va_dcl
 	StrLCat(newfmt, fmt, sizeof(newfmt));
 	if (tag)
 	    StrLCat(newfmt, tag, sizeof(newfmt));
-	(void) vsprintf(buf, newfmt, ap);
+	(void) vsnprintf(buf, sizeof(buf), newfmt, ap);
 	va_end(ap);
 	SysLog(error_priority, buf);
     }