]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
func_iconv: Ensure output strings are properly terminated. 39/2239/1
authorSean Bright <sean.bright@gmail.com>
Thu, 11 Feb 2016 17:21:42 +0000 (12:21 -0500)
committerSean Bright <sean.bright@gmail.com>
Thu, 11 Feb 2016 17:25:54 +0000 (11:25 -0600)
ASTERISK-25272 #close
Reported by: Etienne Lessard
patches:
 AST-25272.patch submitted by Etienne Lessard (license #6394)

Change-Id: Id75ad202300960a1e91afe15e319d992936ecc17

funcs/func_iconv.c

index c3d02865cc729729e1b8068180c0310276ca77cd..0a8e57dd7256dd282dc01582506bce9dcc304f1c 100644 (file)
@@ -83,7 +83,7 @@ static int iconv_read(struct ast_channel *chan, const char *cmd, char *arguments
                AST_APP_ARG(text);
        );
        iconv_t cd;
-       size_t incount, outcount = len;
+       size_t incount, outcount = len - 1;
        char *parse;
 
        if (ast_strlen_zero(arguments)) {
@@ -120,6 +120,7 @@ static int iconv_read(struct ast_channel *chan, const char *cmd, char *arguments
                else
                        ast_log(LOG_WARNING,  "Iconv: error %d: %s.\n", errno, strerror(errno));
        }
+       *buf = '\0';
        iconv_close(cd);
 
        return 0;