diff --git a/foo2ddst.c b/foo2ddst.c index c8bfd07..5501796 100644 --- a/foo2ddst.c +++ b/foo2ddst.c @@ -1439,7 +1439,10 @@ main(int argc, char *argv[]) error(1, "Illegal Y value '%s' for -g\n", optarg); break; case 'm': MediaCode = atoi(optarg); break; - case 'n': Copies = atoi(optarg); break; + case 'n': Copies = atoi(optarg); + if (Copies < 1 || Copies > 999) + error(1, "Illegal value '%s' for Copies -n\n", optarg); + break; case 'p': PaperCode = atoi(optarg); break; case 'r': if (parse_xy(optarg, &ResX, &ResY)) error(1, "Illegal format '%s' for -r\n", optarg); diff --git a/foo2hbpl2.c b/foo2hbpl2.c index 4da685b..65d8802 100644 --- a/foo2hbpl2.c +++ b/foo2hbpl2.c @@ -1521,7 +1521,10 @@ main(int argc, char *argv[]) error(1, "Illegal Y value '%s' for -g\n", optarg); break; case 'm': MediaCode = atoi(optarg); break; - case 'n': Copies = atoi(optarg); break; + case 'n': Copies = atoi(optarg); + if (Copies < 1 || Copies > 999) + error(1, "Illegal value '%s' for Copies -n\n", optarg); + break; case 'p': PaperCode = atoi(optarg); break; case 'r': if (parse_xy(optarg, &ResX, &ResY)) error(1, "Illegal format '%s' for -r\n", optarg); diff --git a/foo2hiperc.c b/foo2hiperc.c index bb220ea..f1fdee5 100644 --- a/foo2hiperc.c +++ b/foo2hiperc.c @@ -1595,7 +1595,10 @@ main(int argc, char *argv[]) error(1, "Illegal Y value '%s' for -g\n", optarg); break; case 'm': MediaCode = atoi(optarg); break; - case 'n': Copies = atoi(optarg); break; + case 'n': Copies = atoi(optarg); + if (Copies < 1 || Copies > 999) + error(1, "Illegal value '%s' for Copies -n\n", optarg); + break; case 'p': PaperCode = atoi(optarg); break; case 'r': if (parse_xy(optarg, &ResX, &ResY)) error(1, "Illegal format '%s' for -r\n", optarg); diff --git a/foo2hp.c b/foo2hp.c index 0f73451..d17c8c5 100644 --- a/foo2hp.c +++ b/foo2hp.c @@ -1708,7 +1708,10 @@ main(int argc, char *argv[]) error(1, "Illegal Y value '%s' for -g\n", optarg); break; case 'm': MediaCode = atoi(optarg); break; - case 'n': Copies = atoi(optarg); break; + case 'n': Copies = atoi(optarg); + if (Copies < 1 || Copies > 999) + error(1, "Illegal value '%s' for Copies -n\n", optarg); + break; case 'p': PaperCode = atoi(optarg); break; case 'r': if (parse_xy(optarg, &ResX, &ResY)) error(1, "Illegal format '%s' for -r\n", optarg); diff --git a/foo2lava.c b/foo2lava.c index 7caa7ad..8115203 100644 --- a/foo2lava.c +++ b/foo2lava.c @@ -1559,7 +1559,10 @@ main(int argc, char *argv[]) else MediaCode = atoi(optarg); break; - case 'n': Copies = atoi(optarg); break; + case 'n': Copies = atoi(optarg); + if (Copies < 1 || Copies > 999) + error(1, "Illegal value '%s' for Copies -n\n", optarg); + break; case 'p': if (strstr(optarg,"in") || strstr(optarg, "mm")) PaperStr = optarg; else diff --git a/foo2oak.c b/foo2oak.c index 65acdfc..646d012 100644 --- a/foo2oak.c +++ b/foo2oak.c @@ -1921,7 +1921,10 @@ main(int argc, char *argv[]) error(1, "Illegal Y value '%s' for -g\n", optarg); break; case 'm': MediaCode = atoi(optarg); break; - case 'n': Copies = atoi(optarg); break; + case 'n': Copies = atoi(optarg); + if (Copies < 1 || Copies > 999) + error(1, "Illegal value '%s' for Copies -n\n", optarg); + break; case 'p': PaperCode = atoi(optarg); break; case 'r': if (parse_xy(optarg, &ResX, &ResY)) error(1, "Illegal format '%s' for -r\n", optarg); diff --git a/foo2qpdl.c b/foo2qpdl.c index 40d2093..2fd135b 100644 --- a/foo2qpdl.c +++ b/foo2qpdl.c @@ -1735,7 +1735,10 @@ main(int argc, char *argv[]) error(1, "Illegal Y value '%s' for -g\n", optarg); break; case 'm': MediaCode = atoi(optarg); break; - case 'n': Copies = atoi(optarg); break; + case 'n': Copies = atoi(optarg); + if (Copies < 1 || Copies > 999) + error(1, "Illegal value '%s' for Copies -n\n", optarg); + break; case 'p': PaperCode = atoi(optarg); break; case 'r': if (parse_xy(optarg, &ResX, &ResY)) error(1, "Illegal format '%s' for -r\n", optarg); diff --git a/foo2slx.c b/foo2slx.c index 7e2ffdd..75048ac 100644 --- a/foo2slx.c +++ b/foo2slx.c @@ -1434,7 +1434,10 @@ main(int argc, char *argv[]) error(1, "Illegal Y value '%s' for -g\n", optarg); break; case 'm': MediaCode = atoi(optarg); break; - case 'n': Copies = atoi(optarg); break; + case 'n': Copies = atoi(optarg); + if (Copies < 1 || Copies > 999) + error(1, "Illegal value '%s' for Copies -n\n", optarg); + break; case 'p': PaperCode = atoi(optarg); break; case 'r': if (parse_xy(optarg, &ResX, &ResY)) error(1, "Illegal format '%s' for -r\n", optarg); diff --git a/foo2xqx.c b/foo2xqx.c index 10b9d60..f31529b 100644 --- a/foo2xqx.c +++ b/foo2xqx.c @@ -1381,7 +1381,10 @@ main(int argc, char *argv[]) error(1, "Illegal Y value '%s' for -g\n", optarg); break; case 'm': MediaCode = atoi(optarg); break; - case 'n': Copies = atoi(optarg); break; + case 'n': Copies = atoi(optarg); + if (Copies < 1 || Copies > 999) + error(1, "Illegal value '%s' for Copies -n\n", optarg); + break; case 'p': PaperCode = atoi(optarg); break; case 'r': if (parse_xy(optarg, &ResX, &ResY)) error(1, "Illegal format '%s' for -r\n", optarg); diff --git a/foo2zjs.c b/foo2zjs.c index 98a2c8e..5bc87c3 100644 --- a/foo2zjs.c +++ b/foo2zjs.c @@ -1801,7 +1801,10 @@ main(int argc, char *argv[]) error(1, "Illegal Y value '%s' for -g\n", optarg); break; case 'm': MediaCode = atoi(optarg); break; - case 'n': Copies = atoi(optarg); break; + case 'n': Copies = atoi(optarg); + if (Copies < 1 || Copies > 999) + error(1, "Illegal value '%s' for Copies -n\n", optarg); + break; case 'p': PaperCode = atoi(optarg); break; case 'r': if (parse_xy(optarg, &ResX, &ResY)) error(1, "Illegal format '%s' for -r\n", optarg);