summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2016-02-11 12:21:42 -0500
committerSean Bright <sean.bright@gmail.com>2016-02-11 11:25:54 -0600
commit962a9d61f8666607b25fd3307cd938576ee60da0 (patch)
treea0b6a7319a3e4120d806945308edf3417126ec8f /funcs
parent249d80f1207c0235457a417cc86bf6cd05f5cbdd (diff)
func_iconv: Ensure output strings are properly terminated.
ASTERISK-25272 #close Reported by: Etienne Lessard patches: AST-25272.patch submitted by Etienne Lessard (license #6394) Change-Id: Id75ad202300960a1e91afe15e319d992936ecc17
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_iconv.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/funcs/func_iconv.c b/funcs/func_iconv.c
index c3d02865c..0a8e57dd7 100644
--- a/funcs/func_iconv.c
+++ b/funcs/func_iconv.c
@@ -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;