diff options
author | Barton E. Schaefer <schaefer@zsh.org> | 2015-09-19 23:05:44 -0700 |
---|---|---|
committer | Barton E. Schaefer <schaefer@zsh.org> | 2015-09-19 23:05:44 -0700 |
commit | e61717b6061e77b582313ffc883f40bc5e11ae70 (patch) | |
tree | 9ce820c79369cb3601be823c740a0608171f0723 | |
parent | 4375d7b905dca266c3a14bf603a908eb7c3dfbf2 (diff) | |
download | zsh-e61717b6061e77b582313ffc883f40bc5e11ae70.tar.gz zsh-e61717b6061e77b582313ffc883f40bc5e11ae70.tar.xz zsh-e61717b6061e77b582313ffc883f40bc5e11ae70.zip |
36566: check for regular file before lseek()
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | Src/parse.c | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index 6d99ccd81..70407ca50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2015-09-19 Barton E. Schaefer <schaefer@zsh.org> + * 36566: Src/parse.c: check for regular file before lseek() + * 36562: Src/utils.c: sanitize $PWD on import, per POSIX 2015-09-19 Peter Stephenson <p.w.stephenson@ntlworld.com> 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); |