findutils/find-avoid-buffer-overflow-with-printf-T.patch

35 lines
1.1 KiB
Diff
Raw Normal View History

2019-09-30 10:38:48 -04:00
From febde26dd0e66dda5d4060fa29b85443ddc6a865 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Mon, 28 Aug 2017 23:15:12 +0200
Subject: [PATCH 117/224] find: avoid buffer-overflow with -printf '%T+'
* find/print.c (format_date): Increase size of local variable
FMT to match the longest possible content.
Fixes https://bugs.debian.org/873032 reported upstream by
Andreas Metzler in https://savannah.gnu.org/bugs/?51841;
fix proposed by Kamil Dudka.
Bug introduced in commit v4.6.0-111-g95816b2, so no released version
ever saw this; therefore not adding a NEWS entry.
---
find/print.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/find/print.c b/find/print.c
index 682197f4..6b568d9c 100644
--- a/find/print.c
+++ b/find/print.c
@@ -611,7 +611,7 @@ format_date (struct timespec ts, int kind)
char ns_buf[NS_BUF_LEN]; /* -.9999999990 (- sign can happen!)*/
int charsprinted, need_ns_suffix;
struct tm *tm;
- char fmt[6];
+ char fmt[12];
/* human_readable() assumes we pass a buffer which is at least as
* long as LONGEST_HUMAN_READABLE. We use an assertion here to
--
2.19.1