mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
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
This commit is contained in:
@@ -83,7 +83,7 @@ static int iconv_read(struct ast_channel *chan, const char *cmd, char *arguments
|
|||||||
AST_APP_ARG(text);
|
AST_APP_ARG(text);
|
||||||
);
|
);
|
||||||
iconv_t cd;
|
iconv_t cd;
|
||||||
size_t incount, outcount = len;
|
size_t incount, outcount = len - 1;
|
||||||
char *parse;
|
char *parse;
|
||||||
|
|
||||||
if (ast_strlen_zero(arguments)) {
|
if (ast_strlen_zero(arguments)) {
|
||||||
@@ -120,6 +120,7 @@ static int iconv_read(struct ast_channel *chan, const char *cmd, char *arguments
|
|||||||
else
|
else
|
||||||
ast_log(LOG_WARNING, "Iconv: error %d: %s.\n", errno, strerror(errno));
|
ast_log(LOG_WARNING, "Iconv: error %d: %s.\n", errno, strerror(errno));
|
||||||
}
|
}
|
||||||
|
*buf = '\0';
|
||||||
iconv_close(cd);
|
iconv_close(cd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user