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 59919ec776
commit bdcb85b56a
2 changed files with 2 additions and 2 deletions

View file

@ -97,7 +97,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->builtin.casemap_full,
.init = false,

View file

@ -304,7 +304,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,