[Asterisk-code-review] func iconv: Ensure output strings are properly terminated. (asterisk[master])

Anonymous Coward asteriskteam at digium.com
Thu Feb 11 16:38:57 CST 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: func_iconv: Ensure output strings are properly terminated.
......................................................................


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
---
M funcs/func_iconv.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/funcs/func_iconv.c b/funcs/func_iconv.c
index 9582d67..db52b11 100644
--- a/funcs/func_iconv.c
+++ b/funcs/func_iconv.c
@@ -83,7 +83,7 @@
 		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 @@
 		else
 			ast_log(LOG_WARNING,  "Iconv: error %d: %s.\n", errno, strerror(errno));
 	}
+	*buf = '\0';
 	iconv_close(cd);
 
 	return 0;

-- 
To view, visit https://gerrit.asterisk.org/2240
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id75ad202300960a1e91afe15e319d992936ecc17
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list