Re: PATCH: Fix wrong size argument to pg_strncasecmp

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

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dominik Czarnota <dominik.b.czarnota@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2020-01-31T22:28:16Z
Lists: pgsql-hackers
Dominik Czarnota <dominik.b.czarnota@gmail.com> writes:
> This patch fixes a size parameter of `pg_strncasecmp` which compared a
> "string" literal with a variable by passing a size of 5 while the "string"
> literal has 6 bytes.

Pushed, thanks for the report!

> By the way, the `strncasecmp` usages around the fixed line could use
> `strcasecmp` which doesn't accept the `size_t n` argument.

Maybe.  It's not clear to me that it's be okay to assume that the
variable input string is null-terminated.

			regards, tom lane



Commits

  1. Fix not-quite-right string comparison in parse_jsonb_index_flags().