summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-01-17 12:00:23 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-01-17 12:00:23 +0000
commit06eaf0bc49fea082c8b8358680815d807a7a925e (patch)
treef4d9a1a3a6f0ef0ce15edc648b1335e1a3012c04 /doio.c
parenta81cd81f8e04bbc8bb5b6ca8cd8516f6206c6912 (diff)
downloadperl-06eaf0bc49fea082c8b8358680815d807a7a925e.tar.gz
sanity check piped opens (tweaked version of patch suggested
by Mark-Jason Dominus) p4raw-id: //depot/perl@2629
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/doio.c b/doio.c
index 641046b731..48e6c62fbf 100644
--- a/doio.c
+++ b/doio.c
@@ -188,6 +188,13 @@ do_open(GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawpe
if (*name == '|') {
/*SUPPRESS 530*/
for (name++; isSPACE(*name); name++) ;
+ if (*name == '\0') { /* command is missing 19990114 */
+ dTHR;
+ if (ckWARN(WARN_PIPE))
+ warner(WARN_PIPE, "Missing command in piped open");
+ errno = EPIPE;
+ goto say_false;
+ }
if (strNE(name,"-"))
TAINT_ENV();
TAINT_PROPER("piped open");
@@ -285,6 +292,13 @@ do_open(GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawpe
name[--len] = '\0';
/*SUPPRESS 530*/
for (; isSPACE(*name); name++) ;
+ if (*name == '\0') { /* command is missing 19990114 */
+ dTHR;
+ if (ckWARN(WARN_PIPE))
+ warner(WARN_PIPE, "Missing command in piped open");
+ errno = EPIPE;
+ goto say_false;
+ }
if (strNE(name,"-"))
TAINT_ENV();
TAINT_PROPER("piped open");