Re: [PATCH] Fix missing argument handling in psql getopt

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Quentin Rameau <quinq@fifth.space>
Cc: pgsql-hackers@postgresql.org
Date: 2019-08-25T15:02:32Z
Lists: pgsql-hackers
Quentin Rameau <quinq@fifth.space> writes:
> When passing an argument option with a missing argument, strcmp would
> be called with the argv terminating NULL.

Um ... so how would control get there with optind too large?
What test case/platform are you considering?

(There really shouldn't be *any* case where getopt advances
optind past argc, imo.)

			regards, tom lane



Commits

  1. Avoid platform-specific null pointer dereference in psql.