]> gitweb.michael.orlitzky.com - iconv-quirks.git/commitdiff
main.c: fix tocode malloc in test_iconv_suffix_drops_untranslatable()
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 7 Jul 2026 13:56:26 +0000 (09:56 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 7 Jul 2026 13:56:26 +0000 (09:56 -0400)
A copy & paste mistake was allocating one byte fewer than we need.

main.c

diff --git a/main.c b/main.c
index 97f251fc2052396a904ed13ecca3ebc2d995c079..1b5d210cf4fd1edcf4363349c0689cc0f5e0cfa6 100644 (file)
--- a/main.c
+++ b/main.c
@@ -479,7 +479,7 @@ static int test_translit_does_not_fail_on_untranslatable() {
 static int test_iconv_suffix_drops_untranslatable(char* suffix) {
   iconv_t cd;
   const char* fromcode = "UTF-8";
-  char* tocode = malloc(strlen(fromcode) + strlen(suffix) + 1);
+  char* tocode = malloc(5 + strlen(suffix) + 1); // 5 = strlen("ASCII")
   sprintf(tocode, "ASCII%s", suffix);
 
   char msg[59];