aboutsummaryrefslogtreecommitdiff
path: root/name.c
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-10 18:22:18 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-10 18:23:02 +0200
commit4c4fd309cf5c0ea28c17c9b90ebe073a66dcaf72 (patch)
treecc50bf7be9881c2f2090249c5a15821ab0a41510 /name.c
parentf731d36d9229a57844551ebcfe78c91a1e9a37ec (diff)
downloadre-name-4c4fd309cf5c0ea28c17c9b90ebe073a66dcaf72.tar.gz
name.c: Do not read more than MAXFILES lines
Diffstat (limited to 'name.c')
-rw-r--r--name.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/name.c b/name.c
index e9c13d7..a98c051 100644
--- a/name.c
+++ b/name.c
@@ -64,13 +64,13 @@ usage: fprintf(stderr, "usage: %s [-x]\n", name);
err(1, "fopen");
/* Read original file names. */
- for (i = 0; fgets(tmp, MAXLINE, fp); i++) {
+ for (i = 0; i < MAXFILES && fgets(tmp, MAXLINE, fp); i++) {
tmp[strcspn(tmp, "\n")] = 0;
strcpy(froms[i], tmp);
}
/* Read new file names. */
- for (j = 0; fgets(tmp, MAXLINE, stdin); j++) {
+ for (j = 0; j < MAXFILES && fgets(tmp, MAXLINE, stdin); j++) {
tmp[strcspn(tmp, "\n")] = 0;
strcpy(tos[j], tmp);
}