diff options
-rw-r--r-- | generic/Image.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/generic/Image.c b/generic/Image.c index ff5174f..a0dbc99 100644 --- a/generic/Image.c +++ b/generic/Image.c @@ -1396,8 +1396,10 @@ ZnGetFontEncoding(ZnWInfo *wi, charset++; } /* Get a lower case string */ - charset_lc = ZnMalloc(sizeof(charset)+1); - for (count = strlen(charset)-1; count >= 0; count--) { + count = strlen(charset); + charset_lc = ZnMalloc(count+1); + charset_lc[count] = '\000'; + for (count--; count >= 0; count--) { charset_lc[count] = tolower(charset[count]); } charset = charset_lc; |