clock_to_utf8() has an early return that simply strdup()'s the input
string without respecting in_len. This replaces that call with an
expanded strndup() (strndup itself is a non-portable GNU extension)
---
:100644 100644 cbb0e42... 84bda3d... M  xclock/Clock.c
 xclock/Clock.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/xclock/Clock.c b/xclock/Clock.c
index cbb0e42..84bda3d 100644
--- a/xclock/Clock.c
+++ b/xclock/Clock.c
@@ -2232,8 +2232,13 @@ clock_to_utf8(const char *str, int in_len)
     if (str == NULL ||code_set == NULL || strcasecmp(code_set, "646") == 0)
        return NULL;
 
-    if (strcasecmp(code_set, "UTF-8") == 0)
-       return strdup(str);
+    if (strcasecmp(code_set, "UTF-8") == 0) {
+       if ((buf = malloc(in_len + 1)) == NULL)
+               return NULL;
+       buf[in_len] = '\0';
+       memcpy(buf, str, in_len);
+       return buf;
+    }
 
     cd = iconv_open("UTF-8", code_set);
     if (cd == (iconv_t)-1)
-- 
1.7.1




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to