[PATCH 2/4] libblkid: fix format overflow

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

 



libblkid/src/devname.c:166:29: warning: '%s' directive writing up to 255
bytes into a region of size 245 [-Wformat-overflow=]

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 libblkid/src/devname.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libblkid/src/devname.c b/libblkid/src/devname.c
index ba3c57a41..4ee6e3119 100644
--- a/libblkid/src/devname.c
+++ b/libblkid/src/devname.c
@@ -152,12 +152,13 @@ static int is_dm_leaf(const char *devname)
 {
 	struct dirent	*de, *d_de;
 	DIR		*dir, *d_dir;
-	char		path[256];
 	int		ret = 1;
 
 	if ((dir = opendir("/sys/block")) == NULL)
 		return 0;
 	while ((de = readdir(dir)) != NULL) {
+		char path[strlen(de->d_name) + sizeof("/sys/block//slaves") + 1];
+
 		if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..") ||
 		    !strcmp(de->d_name, devname) ||
 		    strncmp(de->d_name, "dm-", 3) ||
-- 
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