[PATCH] diff: handle empty dirs

Peter Korsgaard peter.korsgaard at barco.com
Thu Apr 5 04:31:08 PDT 2007


Hi,

diff currently segfaults on empty dirs as dl is null at the assignment
at line 1100. The following tiny patch fixes it.

Index: coreutils/diff.c
===================================================================
--- coreutils/diff.c	(revision 18333)
+++ coreutils/diff.c	(working copy)
@@ -1070,7 +1070,7 @@
 static char **get_dir(char *path)
 {
 	dl_count = 0;
-	dl = NULL;
+	dl = xmalloc(sizeof(dl[0]));
 
 	/* If -r has been set, then the recursive_action function will be
 	 * used. Unfortunately, this outputs the root directory along with

-- 
Bye, Peter Korsgaard


More information about the busybox mailing list