forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6338fa3
committed
Avoid platform-specific null pointer dereference in psql.
POSIX permits getopt() to advance optind beyond argc when the lastargv entry is an option that requires an argument and hasn't got one.It seems that no major platforms actually do that, but musl does,so that something like "psql -f" would crash with that libc.Add a check that optind is in range before trying to look at thepossibly-bogus option.Report and fix by Quentin Rameau. Back-patch to all supportedbranches.Discussion:https://postgr.es/m/20190825100617.GA6087@fifth.space1 parentfaee5a1 commit6338fa3
1 file changed
+6
-3
lines changedLines changed: 6 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
666 | 666 |
| |
667 | 667 |
| |
668 | 668 |
| |
669 |
| - | |
670 |
| - | |
| 669 | + | |
| 670 | + | |
671 | 671 |
| |
| 672 | + | |
672 | 673 |
| |
673 | 674 |
| |
674 | 675 |
| |
675 |
| - | |
676 | 676 |
| |
| 677 | + | |
| 678 | + | |
677 | 679 |
| |
| 680 | + | |
678 | 681 |
| |
679 | 682 |
| |
680 | 683 |
| |
|
0 commit comments
Comments
(0)