[Commits] [SCM] claws branch, master, updated. 3.13.0-41-gd390fa0

Colin colin at claws-mail.org
Wed Nov 4 22:40:58 CET 2015


The branch, master has been updated
       via  d390fa07f5548f3173dd9cc13b233db5ce934c82 (commit)
      from  03500608c823556578c8ea6fcdb33100fa717ec4 (commit)

Summary of changes:
 src/codeconv.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)


- Log -----------------------------------------------------------------
commit d390fa07f5548f3173dd9cc13b233db5ce934c82
Author: Colin Leroy <colin at colino.net>
Date:   Wed Nov 4 22:40:32 2015 +0100

    Make sure we don't run out of the output buffer. Maybe fixes bug #3557

diff --git a/src/codeconv.c b/src/codeconv.c
index 42ac01c..39e259f 100644
--- a/src/codeconv.c
+++ b/src/codeconv.c
@@ -155,10 +155,10 @@ void codeconv_set_strict(gboolean mode)
 static gint conv_jistoeuc(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
 	const guchar *in = inbuf;
-	guchar *out = outbuf;
+	gchar *out = outbuf;
 	JISState state = JIS_ASCII;
 
-	while (*in != '\0') {
+	while (*in != '\0' && (out - outbuf) > outlen - 3) {
 		if (*in == ESC) {
 			in++;
 			if (*in == '$') {
@@ -291,10 +291,10 @@ static gint conv_jis_hantozen(guchar *outbuf, guchar jis_code, guchar sound_sym)
 static gint conv_euctojis(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
 	const guchar *in = inbuf;
-	guchar *out = outbuf;
+	gchar *out = outbuf;
 	JISState state = JIS_ASCII;
 
-	while (*in != '\0') {
+	while (*in != '\0' && (out - outbuf) < outlen - 3) {
 		if (IS_ASCII(*in)) {
 			K_OUT();
 			*out++ = *in++;
@@ -380,9 +380,9 @@ static gint conv_euctojis(gchar *outbuf, gint outlen, const gchar *inbuf)
 static gint conv_sjistoeuc(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
 	const guchar *in = inbuf;
-	guchar *out = outbuf;
+	gchar *out = outbuf;
 
-	while (*in != '\0') {
+	while (*in != '\0' && (out - outbuf) < outlen - 3) {
 		if (IS_ASCII(*in)) {
 			*out++ = *in++;
 		} else if (issjiskanji1(*in)) {

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list