aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGene Cumm <gene.cumm@gmail.com>2010-10-02 00:13:38 -0400
committerGene Cumm <gene.cumm@gmail.com>2010-10-09 07:33:07 -0400
commitfca730eca4bc6730c5e514b8148f43e6d02fc3b2 (patch)
tree33dc7e176bc319ebc8401339e485e55536392c01
parente7685ec249951e33fa7ff282f4fdc3a9a2c1e2ce (diff)
downloadsyslinux-fca730eca4bc6730c5e514b8148f43e6d02fc3b2.tar.gz
syslinux-fca730eca4bc6730c5e514b8148f43e6d02fc3b2.tar.xz
syslinux-fca730eca4bc6730c5e514b8148f43e6d02fc3b2.zip
rosh: Fix rosh_ls_arg() to prevent segfault on access denied
-rw-r--r--com32/rosh/rosh.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index bed75cc3..8d4b501e 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);