Skip to content

Commit

Permalink
Merge pull request #2 from biergaizi/upstream
Browse files Browse the repository at this point in the history
[cctools] fix ar(1) crash without argument
  • Loading branch information
grobian authored May 29, 2023
2 parents de3eb17 + 86d7771 commit 0d77d50
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 0d77d50

Please sign in to comment.