From e61717b6061e77b582313ffc883f40bc5e11ae70 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 19 Sep 2015 23:05:44 -0700 Subject: 36566: check for regular file before lseek() --- Src/parse.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Src/parse.c') diff --git a/Src/parse.c b/Src/parse.c index 7c2d20250..a26df6f0a 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -3227,6 +3227,8 @@ build_dump(char *nam, char *dump, char **files, int ali, int map, int flags) noaliases = ali; for (hlen = FD_PRELEN, tlen = 0; *files; files++) { + struct stat st; + if (!strcmp(*files, "-k")) { flags = (flags & ~(FDHF_KSHLOAD | FDHF_ZSHLOAD)) | FDHF_KSHLOAD; continue; @@ -3235,6 +3237,7 @@ build_dump(char *nam, char *dump, char **files, int ali, int map, int flags) continue; } if ((fd = open(*files, O_RDONLY)) < 0 || + fstat(fd, &st) != 0 || !S_ISREG(st.st_mode) || (flen = lseek(fd, 0, 2)) == -1) { if (fd >= 0) close(fd); -- cgit 1.4.1