Fix callers of unicode_strtitle() using srclen == -1.

Currently, only called that way in tests, which failed to fail.

Discussion: https://postgr.es/m/581a72ff452bb045ba83bbe3c6cf4467702d4f0f.camel@j-davis.com
Backpatch-through: 18
This commit is contained in:
Jeff Davis 2026-04-20 14:44:08 -07:00
parent 16fb94605c
commit 6044f55a47
2 changed files with 2 additions and 2 deletions

View file

@ -91,7 +91,7 @@ strtitle_builtin(char *dest, size_t destsize, const char *src, ssize_t srclen,
{
struct WordBoundaryState wbstate = {
.str = src,
.len = srclen,
.len = (srclen < 0) ? strlen(src) : srclen,
.offset = 0,
.posix = !locale->info.builtin.casemap_full,
.init = false,

View file

@ -303,7 +303,7 @@ tfunc_title(char *dst, size_t dstsize, const char *src,
{
struct WordBoundaryState wbstate = {
.str = src,
.len = srclen,
.len = (srclen < 0) ? strlen(src) : srclen,
.offset = 0,
.init = false,
.prev_alnum = false,