Content-Length: 259196 | pFad | http://github.com/postgrespro/postgres_cluster/commit/d1fcc622987c1a5b490b956d89f36ac9fed8f9d1

21 Fix incorrect buffer-length argument to uloc_getDisplayName(). · postgrespro/postgres_cluster@d1fcc62 · GitHub
Skip to content

Commit d1fcc62

Browse files
committed
Fix incorrect buffer-length argument to uloc_getDisplayName().
The maxResultSize argument of uloc_getDisplayName is the number of UChars in the output buffer, not the number of bytes. In principle this could result in a stack smash, although at least in my Fedora 25 install there are no ICU locales with display names long enough to overrun the buffer. But it's easily proven to be wrong by reducing the length of displayname to around 20, whereupon a stack smash does happen. (This is a rather scary bug, because the same mistake could easily have been made in other places; but in a quick code search looking at uses of UChar I could not find any other instances.)
1 parent 08859bb commit d1fcc62

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/commands/collationcmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ get_icu_locale_comment(const char *localename)
443443

444444
status = U_ZERO_ERROR;
445445
len_uchar = uloc_getDisplayName(localename, "en",
446-
&displayname[0], sizeof(displayname),
446+
displayname, lengthof(displayname),
447447
&status);
448448
if (U_FAILURE(status))
449449
ereport(ERROR,

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/d1fcc622987c1a5b490b956d89f36ac9fed8f9d1

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy