From 06eaf0bc49fea082c8b8358680815d807a7a925e Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Sun, 17 Jan 1999 12:00:23 +0000 Subject: sanity check piped opens (tweaked version of patch suggested by Mark-Jason Dominus) p4raw-id: //depot/perl@2629 --- doio.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'doio.c') 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"); -- cgit v1.2.1