parted/0036-ui-Fix-gcc-10-warning-about-snprintf-truncating-an-i.patch

32 lines
954 B
Diff

From 6e34cb98ddef0c9fd47359a2006265e7251e8830 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 12 Nov 2020 16:49:29 -0800
Subject: [PATCH 36/42] ui: Fix gcc 10 warning about snprintf truncating an int
Double the storage to 20 bytes.
---
parted/ui.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/parted/ui.c b/parted/ui.c
index 8e1f2fe..73fdcf5 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -909,11 +909,11 @@ command_line_get_word (const char* prompt, const char* def,
int
command_line_get_integer (const char* prompt, int* value)
{
- char def_str [10];
+ char def_str [20];
char* input;
long ret;
- snprintf (def_str, 10, "%d", *value);
+ snprintf (def_str, 20, "%d", *value);
input = command_line_get_word (prompt, *value ? def_str : NULL,
NULL, 1);
if (!input)
--
2.26.2