CHARCONV: Fix handling conversion errors
authorAlexander Barton <alex@barton.de>
Sun, 23 Feb 2014 17:20:47 +0000 (18:20 +0100)
committerAlexander Barton <alex@barton.de>
Sun, 23 Feb 2014 17:20:47 +0000 (18:20 +0100)
Don't overwrite already converted text!

src/ngircd/conn-encoding.c

index 98cd29a367047323d1633f57f2473443075215d9..d0c56306698bbe599900073690a127e4e06c8a3a 100644 (file)
@@ -125,7 +125,7 @@ Convert_Message(iconv_t Handle, char *Message)
        if (iconv(Handle, &Message, &in_left, &out, &out_left) == (size_t)(-1)) {
                /* An error occurred! */
                LogDebug("Error converting message encoding!");
-               strlcpy(Encoding_Buffer, Message, sizeof(Encoding_Buffer));
+               strlcpy(out, Message, sizeof(Encoding_Buffer));
                iconv(Handle, NULL, NULL, NULL, NULL);
        } else
                *out = '\0';