File: ssfe-Use-snprintf-and-a-larger-buffer.patch

package info (click to toggle)
vte 1%3A0.28.2-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,140 kB
  • sloc: ansic: 33,674; sh: 10,491; makefile: 541; python: 194; xml: 151
file content (31 lines) | stat: -rw-r--r-- 1,041 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
From: Simon McVittie <smcv@debian.org>
Date: Fri, 27 Dec 2024 12:58:32 +0000
Subject: ssfe: Use snprintf() and a larger buffer
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

In function ‘sprintf’,
    inlined from ‘do_cs’ at ssfe.c:153:5,
    inlined from ‘do_cs.isra’ at ssfe.c:150:12:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:30:10: note: ‘__builtin___sprintf_chk’ output between 7 and 17 bytes into a destination of size 16
---
 src/ssfe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ssfe.c b/src/ssfe.c
index 31250c0..a3b54ef 100644
--- a/src/ssfe.c
+++ b/src/ssfe.c
@@ -148,9 +148,9 @@ static void putcap(unsigned char *s) {
 }
 
 static int do_cs(int y1, int y2) {
-  static char temp[16];
+  static char temp[18];
   if (ansi_cs) {
-    sprintf(temp, "%c[%d;%dr", 27, y1, y2);
+    snprintf(temp, sizeof (temp), "%c[%d;%dr", 27, y1, y2);
     write(1, temp, strlen(temp));
   } else putcap((char *)tgoto(t_cs, y2-1, y1-1));
   return 0;