"hammer cleanup" seg faults

Rumko rumcic at gmail.com
Sun Dec 7 15:44:57 PST 2008


Trying to run "hammer cleanup" results in a seg fault because strstr() is
called with the first parameter set to null ... attached patch adds an arg3 !=
NULL check ... simple, but tested to work
-- 
Regards,
Rumko
diff --git a/sbin/hammer/cmd_cleanup.c b/sbin/hammer/cmd_cleanup.c
index 8366286..ef4e448 100644
--- a/sbin/hammer/cmd_cleanup.c
+++ b/sbin/hammer/cmd_cleanup.c
@@ -511,7 +511,7 @@ cleanup_softlinks(const char *path __unused, const char *snapshots_path,
 	char *fpath;
 	int anylink = 0;
 
-	if (strstr(arg3, "any") != NULL)
+	if (arg3 != NULL && strstr(arg3, "any") != NULL)
 		anylink = 1;
 
 	if ((dir = opendir(snapshots_path)) != NULL) {





More information about the Bugs mailing list