Commit a43219f
rev-parse: check i before using argv[i] against argc
The --prefix, --default, and --resolve-git-dir options to
git-rev-parse require an argument, but when given no argument,
the code uses the NULL read from argv[argc] without checking,
leading to a segfault.
Instead, check first and die() with an error message.
Signed-off-by: David Sharp <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent d2446df commit a43219f
1 file changed
+11
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
526 | | - | |
527 | | - | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
528 | 529 | | |
529 | 530 | | |
530 | 531 | | |
531 | | - | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
532 | 535 | | |
533 | 536 | | |
534 | | - | |
535 | 537 | | |
536 | 538 | | |
537 | 539 | | |
| |||
703 | 705 | | |
704 | 706 | | |
705 | 707 | | |
706 | | - | |
| 708 | + | |
707 | 709 | | |
708 | | - | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
709 | 714 | | |
710 | 715 | | |
711 | 716 | | |
| |||
0 commit comments