lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1251054836-5708-1-git-send-email-kzak@redhat.com>
Date:	Sun, 23 Aug 2009 21:13:56 +0200
From:	Karel Zak <kzak@...hat.com>
To:	"Theodore Ts'o" <tytso@....edu>
Cc:	linux-ext4@...r.kernel.org, Karel Zak <kzak@...hat.com>
Subject: [PATCH] blkid: support .ko.gz in modules.dep parser

The Linux kernel modules could be compressed, it means modules.dep
parser in libblid has to support .ko.gz extension too.

(Note, I've talked about this problem with Jon Masters and his
suggestion is to exec(/sbin/modinfo) rather than directly parse
modules.dep. BTW, the modules.dep file is deprecated.)

Address-Red-Hat-Bug: #518572
Signed-off-by: Karel Zak <kzak@...hat.com>
---
 lib/blkid/probe.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
index 8f6cfa6..6b75732 100644
--- a/lib/blkid/probe.c
+++ b/lib/blkid/probe.c
@@ -208,8 +208,8 @@ static int check_for_modules(const char *fs_name)
 #ifdef __linux__
 	struct utsname	uts;
 	FILE		*f;
-	char		buf[1024], *cp, *t;
-	int		i;
+	char		buf[1024], *cp;
+	int		namesz;
 
 	if (uname(&uts))
 		return (0);
@@ -218,6 +218,9 @@ static int check_for_modules(const char *fs_name)
 	f = fopen(buf, "r");
 	if (!f)
 		return (0);
+
+	namesz = strlen(fs_name);
+
 	while (!feof(f)) {
 		if (!fgets(buf, sizeof(buf), f))
 			break;
@@ -229,13 +232,9 @@ static int check_for_modules(const char *fs_name)
 			cp++;
 		else
 			cp = buf;
-		i = strlen(cp);
-		if (i > 3) {
-			t = cp + i - 3;
-			if (!strcmp(t, ".ko"))
-				*t = 0;
-		}
-		if (!strcmp(cp, fs_name)) {
+		if (!strncmp(cp, fs_name, namesz) &&
+		    (!strcmp(cp + namesz, ".ko") ||
+		     !strcmp(cp + namesz, ".ko.gz"))) {
 			fclose(f);
 			return (1);
 		}
-- 
1.6.2.5

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ