All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: Sami Kerola <kerolasa@iki.fi>
Subject: [PATCH 3/4] lib/loopdev: fix format overflow
Date: Sat, 27 May 2017 19:24:08 +0100	[thread overview]
Message-ID: <20170527182409.13985-3-kerolasa@iki.fi> (raw)
In-Reply-To: <20170527182409.13985-1-kerolasa@iki.fi>

lib/loopdev.c:546:32: warning: '/loop/backing_file' directive output may be
truncated writing 18 bytes into a region of size between 1 and 256
[-Wformat-truncation=]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 lib/loopdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/loopdev.c b/lib/loopdev.c
index fd4f16692..c1d56f7b4 100644
--- a/lib/loopdev.c
+++ b/lib/loopdev.c
@@ -533,7 +533,7 @@ static int loopcxt_next_from_sysfs(struct loopdev_cxt *lc)
 	fd = dirfd(iter->sysblock);
 
 	while ((d = readdir(iter->sysblock))) {
-		char name[256];
+		char name[sizeof(d->d_name) + sizeof("/loop/backing_file") + 1];
 		struct stat st;
 
 		DBG(ITER, ul_debugobj(iter, "check %s", d->d_name));
-- 
2.13.0


  parent reply	other threads:[~2017-05-27 18:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-27 18:24 [PATCH 1/4] last: fix format overflow Sami Kerola
2017-05-27 18:24 ` [PATCH 2/4] libblkid: " Sami Kerola
2017-05-27 18:24 ` Sami Kerola [this message]
2017-05-27 18:24 ` [PATCH 4/4] lib/sysfs: " Sami Kerola
2017-05-29 10:09   ` Karel Zak
2017-05-29 14:06     ` Sami Kerola
2017-05-31 19:28       ` Yuriy M. Kaminskiy
2017-06-01  8:40         ` Karel Zak
2017-06-14 10:09 ` [PATCH 1/4] last: " Karel Zak

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=20170527182409.13985-3-kerolasa@iki.fi \
    --to=kerolasa@iki.fi \
    --cc=util-linux@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.