diff options
-rw-r--r-- | re.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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)) { |