[PATCH 3/4] lib/loopdev: fix format overflow

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

 



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@xxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux