[syslinux:master] rosh: Fix rosh_ls_arg() to prevent segfault on access denied

syslinux-bot for Gene Cumm gene.cumm at gmail.com
Sun Nov 14 12:54:38 PST 2010


Commit-ID:  fca730eca4bc6730c5e514b8148f43e6d02fc3b2
Gitweb:     http://syslinux.zytor.com/commit/fca730eca4bc6730c5e514b8148f43e6d02fc3b2
Author:     Gene Cumm <gene.cumm at gmail.com>
AuthorDate: Sat, 2 Oct 2010 00:13:38 -0400
Committer:  Gene Cumm <gene.cumm at gmail.com>
CommitDate: Sat, 9 Oct 2010 07:33:07 -0400

rosh: Fix rosh_ls_arg() to prevent segfault on access denied



---
 com32/rosh/rosh.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index bed75cc..8d4b501 100644
--- a/com32/rosh/rosh.c
+++ b/com32/rosh/rosh.c
@@ -779,7 +779,12 @@ void rosh_ls_arg(const char *filestr, const int *optarr)
 	if (S_ISDIR(fdstat.st_mode)) {
 	    ROSH_DEBUG("PATH '%s' is a directory\n", filestr);
 	    d = opendir(filestr);
-	    rosh_ls_arg_dir(filestr, d, optarr);
+	    if (d) {
+		rosh_ls_arg_dir(filestr, d, optarr);
+	    } else {
+		rosh_error(errno, "ls", filestr);
+		errno = 0;
+	    }
 	    closedir(d);
 	} else {
 	    de.d_ino = rosh_ls_d_ino(&fdstat);



More information about the Syslinux-commits mailing list