[PATCH] lib: declared buffer is too small to hold string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Displaying an unsigned 64-bit integer can be represented by up to 20
characters. The 20 bytes buffer reserved to store the formatted string
"%llu Bytes" is to small: (20 + 6) = 26. Hence, a bigger buffer is reserved
to hold this string.

Signed-off-by: Renaud Barbier <renaud.barbier@xxxxxx>
---
 lib/display_options.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/display_options.c b/lib/display_options.c
index 2d695e4..0f65f59 100644
--- a/lib/display_options.c
+++ b/lib/display_options.c
@@ -26,7 +26,7 @@
  */
 char *size_human_readable(unsigned long long size)
 {
-	static char buf[20];
+	static char buf[30];
 	unsigned long m = 0, n;
 	unsigned long long f;
 	static const char names[] = {'E', 'P', 'T', 'G', 'M', 'K'};
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux