Skip to contentSkip to conversation

Avoid format truncation

PATCH In review Boian Bonev 2 participants 2 messages Nov 14, 2021 – Nov 15, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Avoid format truncation

io.c:644:17: note: ‘snprintf’ output between 4 and 14 bytes into a destination of size 8

---
 db/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
db/io.c +1 -1
index c79cf105..154c3bd9 100644
@@ -638,7 +638,7 @@ stack_f(
 	char	**argv)
 {
 	int	i;
-	char	tagbuf[8];
+	char	tagbuf[14];
 
 	for (i = iocur_sp; i > 0; i--) {
 		snprintf(tagbuf, sizeof(tagbuf), "%d: ", i);
Signature · 1 line
2.33.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Boian Bonev

io.c:644:17: note: ‘snprintf’ output between 4 and 14 bytes into a destination of size 8

I really hope nobody ever gets to a cursor depth of 4 billion, but the logic is correct, so...

--D

Quoted 20 lines
---
 db/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
db/io.c +1 -1
index c79cf105..154c3bd9 100644
@@ -638,7 +638,7 @@ stack_f(
 	char	**argv)
 {
 	int	i;
-	char	tagbuf[8];
+	char	tagbuf[14];
 
 	for (i = iocur_sp; i > 0; i--) {
 		snprintf(tagbuf, sizeof(tagbuf), "%d: ", i);
Signature · 1 line
2.33.1