0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-01-06 02:26:34 +00:00
termux-packages/packages/hexcurse/716b5d58ac859cc240b8ccb9cbd79ace3e0593c1.patch

35 lines
1.3 KiB
Diff

From 716b5d58ac859cc240b8ccb9cbd79ace3e0593c1 Mon Sep 17 00:00:00 2001
From: Felix Gruber <felgru@gmx.de>
Date: Fri, 5 May 2017 22:20:00 +0200
Subject: [PATCH] fix format truncation error with GCC-7
GCC-7 introduced new warnings and errors. Among them is a new warning
for possible truncations in the output of snprintf. Since we are only
interested in the return value of snprintf and do not use the string
written by it we can also replace the buffer with a NULL pointer.
This makes it explicit that we do not want to write a string and
silences the GCC-7 error.
See also the examples in
http://en.cppreference.com/w/c/io/fprintf
---
src/hexcurse.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/hexcurse.c b/src/hexcurse.c
index 9342eb5..e723ddc 100644
--- a/src/hexcurse.c
+++ b/src/hexcurse.c
@@ -235,10 +235,9 @@ off_t parseArgs(int argc, char *argv[])
\********************************************************/
int getMinimumAddressLength(off_t len)
{
- char buffer[1];
int min_address_length;
- min_address_length = snprintf(buffer, 1, "%jd", (intmax_t)len);
+ min_address_length = snprintf(NULL, 0, "%jd", (intmax_t)len);
/* At least 8 characters wide */
return min_address_length > 8 ? min_address_length : 8;