forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfb55e95
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 parent1fb2d78 commitfb55e95
1 file changed
+6
-3
lines changedLines changed: 6 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
619 | 619 |
| |
620 | 620 |
| |
621 | 621 |
| |
622 |
| - | |
623 |
| - | |
| 622 | + | |
| 623 | + | |
624 | 624 |
| |
| 625 | + | |
625 | 626 |
| |
626 | 627 |
| |
627 | 628 |
| |
628 |
| - | |
629 | 629 |
| |
| 630 | + | |
| 631 | + | |
630 | 632 |
| |
| 633 | + | |
631 | 634 |
| |
632 | 635 |
| |
633 | 636 |
| |
|
0 commit comments
Comments
(0)