Re: PATCH: Fix wrong size argument to pg_strncasecmp

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dominik Czarnota <dominik(dot)b(dot)czarnota(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: PATCH: Fix wrong size argument to pg_strncasecmp
Date: 2020-01-31 22:28:16
Message-ID: 23800.1580509696@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dominik Czarnota <dominik(dot)b(dot)czarnota(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Cleysson Lima 2020-01-31 22:34:18 Re: Created feature for to_date() conversion using patterns 'YYYY-WW', 'YYYY-WW-D', 'YYYY-MM-W' and 'YYYY-MM-W-D'
Previous Message Tom Lane 2020-01-31 22:13:53 Re: widen vacuum buffer counters