diff --git a/libretro-common/string/stdstring.c b/libretro-common/string/stdstring.c index 71b2ea2442..dba253163a 100644 --- a/libretro-common/string/stdstring.c +++ b/libretro-common/string/stdstring.c @@ -159,6 +159,7 @@ char *word_wrap(char* buffer, const char *string, int line_width, bool unicode) while (i < len) { unsigned counter; + int pos = &buffer[i] - buffer; /* copy string until the end of the line is reached */ for (counter = 1; counter <= (unsigned)line_width; counter++) @@ -214,6 +215,9 @@ char *word_wrap(char* buffer, const char *string, int line_width, bool unicode) i = k + 1; break; } + + if (&buffer[i] - buffer == pos) + return buffer; } }