From 5114db9cc2aee9fecc7dde20cfb5b800507c0ac0 Mon Sep 17 00:00:00 2001 From: Hironobu Yamashita Date: Wed, 5 Dec 2018 13:00:50 +0000 Subject: check for missing args, more git-svn-id: svn://tug.org/texlive/trunk@49324 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/ps2pk/ChangeLog | 4 ++++ Build/source/texk/ps2pk/mag.c | 2 ++ Build/source/texk/ps2pk/pk2bm.c | 5 +++++ 3 files changed, 11 insertions(+) (limited to 'Build/source/texk/ps2pk') diff --git a/Build/source/texk/ps2pk/ChangeLog b/Build/source/texk/ps2pk/ChangeLog index c01adf53cd3..09eebc9b8bf 100644 --- a/Build/source/texk/ps2pk/ChangeLog +++ b/Build/source/texk/ps2pk/ChangeLog @@ -1,3 +1,7 @@ +2018-12-05 Hironobu Yamashita + + * mag.c, pk2bm.c: check for missing arguments. + 2018-12-01 Hironobu Yamashita * ps2pk.c: check for missing arguments. diff --git a/Build/source/texk/ps2pk/mag.c b/Build/source/texk/ps2pk/mag.c index 96857286987..3f5c6b61d57 100644 --- a/Build/source/texk/ps2pk/mag.c +++ b/Build/source/texk/ps2pk/mag.c @@ -104,9 +104,11 @@ int main(int argc, char *argv[]) { if (*++argv[0] == '\0') { argc--; argv++; } + if (argv[0] == '\0') goto invalid; DPI = atof(argv[0]); done = 1; break; +invalid: default: fatal("%s: %c invalid option\n", myname, c); } diff --git a/Build/source/texk/ps2pk/pk2bm.c b/Build/source/texk/ps2pk/pk2bm.c index 39303dadf82..5445bf74092 100644 --- a/Build/source/texk/ps2pk/pk2bm.c +++ b/Build/source/texk/ps2pk/pk2bm.c @@ -64,18 +64,21 @@ int main(int argc, char *argv[]) if (*++argv[0] == '\0') { argc--; argv++; } + if (argv[0] == '\0') goto invalid; C = *argv[0]; done = 1; break; case 'o': if (*++argv[0] == '\0') { argc--; ++argv; } + if (argv[0] == '\0') goto invalid; C = atoo(argv[0]); done = 1; break; case 'H': if (*++argv[0] == '\0') { argc--; argv++; } + if (argv[0] == '\0') goto invalid; h = atoi(argv[0]); done=1; break; @@ -83,6 +86,7 @@ int main(int argc, char *argv[]) if (*++argv[0] == '\0') { argc--; argv++; } + if (argv[0] == '\0') goto invalid; w = atoi(argv[0]); done=1; break; @@ -92,6 +96,7 @@ int main(int argc, char *argv[]) case 'h': hexmap = 1; break; +invalid: default: printf("%s: %c invalid option\n", myname, c); exit(1); -- cgit v1.2.3