Skip to content

Commit

Permalink
Merge pull request #8 from biergaizi/upstream
Browse files Browse the repository at this point in the history
[cctools] fix ar(1) crash without argument, closes #7.
  • Loading branch information
iains authored Oct 3, 2023
2 parents 6f6c04e + 86d7771 commit 4defc01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cctools/ar/ar.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ main(argc, argv)
run_ranlib = 1;

if (argc < 3) {
if(strcmp(argv[1], "--version") == 0){
if(argc >= 2 && strcmp(argv[1], "--version") == 0){
/* Implement a gnu-style --version to be friendly to GCC. */
fprintf(stdout, "xtools-%s ar %s\nBased on Apple Inc. %s\n",
xtools_version, package_version, apple_version);
exit(0);
} else if(strcmp(argv[1], "--help") == 0){
} else if(argc >= 2 && strcmp(argv[1], "--help") == 0){
usage(0);
fprintf(stdout, "Please report bugs to %s\n", support_url);
exit(0);
Expand Down

0 comments on commit 4defc01

Please sign in to comment.