aboutsummaryrefslogtreecommitdiff
path: root/libraries/libfido2/0001-log-explicit-truncation-to-placate-gcc-gh-318.patch
blob: 663ca267d6b8e11b55d60ce9d49ef10e1701e207 (plain)
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 487924cda8c6c1a5360e15d4858432d676069f1b Mon Sep 17 00:00:00 2001
From: pedro martelletto <pedro@yubico.com>
Date: Sun, 4 Apr 2021 10:41:24 +0200
Subject: [PATCH] log: explicit truncation to placate gcc; gh#318

---
 src/log.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/log.c b/src/log.c
index 3d603c2a..ab18ae12 100644
--- a/src/log.c
+++ b/src/log.c
@@ -33,14 +33,14 @@ log_on_stderr(const char *str)
 static void
 do_log(const char *suffix, const char *fmt, va_list args)
 {
-	char line[LINELEN], body[LINELEN - 3];
+	char line[LINELEN], body[LINELEN];
 
 	vsnprintf(body, sizeof(body), fmt, args);
 
 	if (suffix != NULL)
-		snprintf(line, sizeof(line), "%s: %s\n", body, suffix);
+		snprintf(line, sizeof(line), "%.180s: %.70s\n", body, suffix);
 	else
-		snprintf(line, sizeof(line), "%s\n", body);
+		snprintf(line, sizeof(line), "%.180s\n", body);
 
 	log_handler(line);
 }