Commit 7c86d96e867e69bfc96b82bf33f3608364d4ebd6

Sam Lantinga 2023-06-04T01:01:06

Fixed SDL_iconv_string() truncation when handling SDL_ICONV_E2BIG (cherry picked from commit c369b900199f905c51edb372bd7780f67a544a8c)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/stdlib/SDL_iconv.c b/src/stdlib/SDL_iconv.c
index 3ab535b..a42f263 100644
--- a/src/stdlib/SDL_iconv.c
+++ b/src/stdlib/SDL_iconv.c
@@ -837,7 +837,8 @@ char *SDL_iconv_string(const char *tocode, const char *fromcode, const char *inb
             outbuf = string + (outbuf - oldstring);
             outbytesleft = stringsize - (outbuf - string);
             SDL_memset(outbuf, 0, 4);
-        } break;
+            continue;
+        }
         case SDL_ICONV_EILSEQ:
             /* Try skipping some input data - not perfect, but... */
             ++inbuf;