postgresql/contrib/ltree
Jeff Davis b8cfe9dc2e Fix multibyte issue in ltree_strncasecmp().
Previously, the API for ltree_strncasecmp() took two inputs but only
one length (that of the smaller input). It truncated the larger input
to that length, but that could break a multibyte sequence.

Change the API to be a check for prefix equality (possibly
case-insensitive) instead, which is all that's needed by the
callers. Also, provide the lengths of both inputs.

Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/5f65b85740197ba6249ea507cddf609f84a6188b.camel%40j-davis.com
Backpatch-through: 14
2025-12-16 10:36:29 -08:00
..
data Add ltree data type to contrib, from Teodor Sigaev and Oleg Bartunov. 2002-07-30 16:40:34 +00:00
expected Add hash support functions and hash opclass for contrib/ltree. 2024-03-21 18:27:49 -04:00
sql Add hash support functions and hash opclass for contrib/ltree. 2024-03-21 18:27:49 -04:00
.gitignore Support "make check" in contrib 2011-04-25 22:27:11 +03:00
_ltree_gist.c Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
_ltree_op.c Split up guc.c for better build speed and ease of maintenance. 2022-09-13 11:11:45 -04:00
crc32.c Adjust MSVC build scripts to parse Makefiles for defines 2021-07-29 12:01:23 +12:00
crc32.h Add support for binary I/O of ltree, lquery, and ltxtquery types. 2020-04-01 17:31:29 -04:00
lquery_op.c Fix multibyte issue in ltree_strncasecmp(). 2025-12-16 10:36:29 -08:00
ltree--1.0--1.1.sql Make contrib modules' installation scripts more secure. 2020-08-10 10:44:42 -04:00
ltree--1.1--1.2.sql Add support for binary I/O of ltree, lquery, and ltxtquery types. 2020-04-01 17:31:29 -04:00
ltree--1.1.sql Update extensions with GIN/GIST support for parallel query. 2016-06-14 13:34:37 -04:00
ltree--1.2--1.3.sql Add hash support functions and hash opclass for contrib/ltree. 2024-03-21 18:27:49 -04:00
ltree.control Add hash support functions and hash opclass for contrib/ltree. 2024-03-21 18:27:49 -04:00
ltree.h Fix multibyte issue in ltree_strncasecmp(). 2025-12-16 10:36:29 -08:00
ltree_gist.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
ltree_io.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
ltree_op.c Add hash support functions and hash opclass for contrib/ltree. 2024-03-21 18:27:49 -04:00
ltreetest.sql Add hash support functions and hash opclass for contrib/ltree. 2024-03-21 18:27:49 -04:00
ltxtquery_io.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
ltxtquery_op.c Fix multibyte issue in ltree_strncasecmp(). 2025-12-16 10:36:29 -08:00
Makefile Add hash support functions and hash opclass for contrib/ltree. 2024-03-21 18:27:49 -04:00
meson.build Add hash support functions and hash opclass for contrib/ltree. 2024-03-21 18:27:49 -04:00