Skip to content

Commit d5e9e23

Browse files
committed
Revert strlen -> strnlen optimization pre-v11.
We don't have a src/port substitute for that function in older branches, so it fails on platforms lacking the function natively. Per buildfarm.
1 parent 8ba4854 commit d5e9e23

File tree

1 file changed

+2
-9
lines changed
  • src/backend/utils/adt

1 file changed

+2
-9
lines changed

src/backend/utils/adt/xml.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,15 +1155,8 @@ parse_xml_decl(const xmlChar *str, size_t *lenp,
11551155
if (xmlStrncmp(p, (xmlChar *) "<?xml", 5) != 0)
11561156
goto finished;
11571157

1158-
/*
1159-
* If next char is a name char, it's a PI like <?xml-stylesheet ...?>
1160-
* rather than an XMLDecl, so we have done what we came to do and found no
1161-
* XMLDecl.
1162-
*
1163-
* We need an input length value for xmlGetUTF8Char, but there's no need
1164-
* to count the whole document size, so use strnlen not strlen.
1165-
*/
1166-
utf8len = strnlen((const char *) (p + 5), MAX_MULTIBYTE_CHAR_LEN);
1158+
/* if next char is name char, it's a PI like <?xml-stylesheet ...?> */
1159+
utf8len = strlen((const char *) (p + 5));
11671160
utf8char = xmlGetUTF8Char(p + 5, &utf8len);
11681161
if (PG_XMLISNAMECHAR(utf8char))
11691162
goto finished;

0 commit comments

Comments
 (0)