mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Renaud Barbier <renaud.barbier@ge.com>
To: barebox@lists.infradead.org
Subject: [PATCH] lib: declared buffer is too small to hold string
Date: Fri,  8 Apr 2016 10:16:10 +0100	[thread overview]
Message-ID: <1460106970-23144-1-git-send-email-renaud.barbier@ge.com> (raw)

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@ge.com>
---
 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2016-04-08  9:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08  9:16 Renaud Barbier [this message]
2016-04-12  6:05 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460106970-23144-1-git-send-email-renaud.barbier@ge.com \
    --to=renaud.barbier@ge.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox