aboutsummaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/re.c b/re.c
index 07b6846..c4490b3 100644
--- a/re.c
+++ b/re.c
@@ -5,7 +5,7 @@
int
main(int argc, char *argv[])
{
- char ans[10], file[30];
+ char *a, ans[10], file[30];
FILE *fp;
int i;
@@ -14,6 +14,17 @@ main(int argc, char *argv[])
return 1;
}
+ /* Ensure arguments do not contain newlines. */
+ for (i = 1; i < argc; i++)
+ for (a = argv[i]; *a; a++)
+ if (*a == '\n') {
+ *a = '*';
+ fprintf(stderr,
+ "%s contains newline (at *)\n",
+ argv[i]);
+ return 1;
+ }
+
sprintf(file, "/var/tmp/re.%d", getppid());
if (!access(file, F_OK)) {