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

Sean Bright asteriskteam at digium.com
Thu Feb 11 11:25:54 CST 2016


Sean Bright has uploaded a new change for review.

  https://gerrit.asterisk.org/2239

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(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/39/2239/1

diff --git a/funcs/func_iconv.c b/funcs/func_iconv.c
index c3d0286..0a8e57d 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/2239
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id75ad202300960a1e91afe15e319d992936ecc17
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>



More information about the asterisk-code-review mailing list