diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2024-03-03 19:11:32 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2024-03-03 19:11:32 +0100 |
commit | 00893e79fc62966067af1a106567db96bd170338 (patch) | |
tree | 52b35cd0b42ca28e62a2ffbecade2e13dd8332cf /lib/uniname/uniname.c | |
parent | 26112352a774737e1ce5580c93654a26c1e82b39 (diff) |
New upstream version 1.2upstream/1.2
Diffstat (limited to 'lib/uniname/uniname.c')
-rw-r--r-- | lib/uniname/uniname.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/uniname/uniname.c b/lib/uniname/uniname.c index 000b00fe..28e2eb70 100644 --- a/lib/uniname/uniname.c +++ b/lib/uniname/uniname.c @@ -1,5 +1,5 @@ /* Association between Unicode characters and their names. - Copyright (C) 2000-2002, 2005-2007, 2009-2022 Free Software Foundation, Inc. + Copyright (C) 2000-2002, 2005-2007, 2009-2024 Free Software Foundation, Inc. This file is free software. It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+". @@ -245,7 +245,7 @@ unicode_character_name (ucs4_t c, char *buf) unsigned int index3; const char *q; - /* buf needs to have at least 16 + 7 bytes here. */ + /* buf needs to have at least 16 + 7 + 1 bytes here. */ memcpy (buf, "HANGUL SYLLABLE ", 16); ptr = buf + 16; @@ -274,7 +274,7 @@ unicode_character_name (ucs4_t c, char *buf) char *ptr; int i; - /* buf needs to have at least 28 + 5 bytes here. */ + /* buf needs to have at least 28 + 5 + 1 bytes here. */ memcpy (buf, "CJK COMPATIBILITY IDEOGRAPH-", 28); ptr = buf + 28; @@ -291,8 +291,8 @@ unicode_character_name (ucs4_t c, char *buf) /* Special case for variation selectors. Keeps the tables small. */ - /* buf needs to have at least 19 + 3 bytes here. */ - sprintf (buf, "VARIATION SELECTOR-%d", + /* buf needs to have at least 19 + 3 + 1 bytes here. */ + sprintf (buf, "VARIATION SELECTOR-%u", c <= 0xFE0F ? c - 0xFE00 + 1 : c - 0xE0100 + 17); return buf; } @@ -339,7 +339,8 @@ unicode_character_name (ucs4_t c, char *buf) if (words != NULL) { /* Found it in unicode_index_to_name. Now concatenate the words. */ - /* buf needs to have at least UNICODE_CHARNAME_MAX_LENGTH bytes. */ + /* buf needs to have at least UNICODE_CHARNAME_MAX_LENGTH + 1 + bytes. */ char *ptr = buf; for (;;) { |