DragonFly bugs List (threaded) for 2008-12
DragonFly BSD
DragonFly bugs List (threaded) for 2008-12
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

"hammer cleanup" seg faults


From: Rumko <rumcic@xxxxxxxxx>
Date: Mon, 08 Dec 2008 00:44:57 +0100

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) {



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