[Commits] [SCM] claws branch, master, updated. 3.17.0-77-g0641e8a

mones at claws-mail.org mones at claws-mail.org
Thu Oct 4 10:31:44 CEST 2018


The branch, master has been updated
       via  0641e8ab944527636061fc4253408ec0de79607e (commit)
      from  c8813ed987cc450627ab73bd8bf7838dfd710bbc (commit)

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


- Log -----------------------------------------------------------------
commit 0641e8ab944527636061fc4253408ec0de79607e
Author: Ricardo Mones <ricardo at mones.org>
Date:   Thu Oct 4 10:30:12 2018 +0200

    Fix CID 1439871 and validate Unicode char strictly

diff --git a/src/entity.c b/src/entity.c
index 6aa0345..aa0c543 100644
--- a/src/entity.c
+++ b/src/entity.c
@@ -337,7 +337,7 @@ static gchar *entity_decode_numeric(gchar *str)
 	gchar b[ENTITY_MAX_LEN];
 	gchar *p = str, *res;
 	gboolean hex = FALSE;
-	gunichar c = -1;
+	gunichar c = 0;
 	gint ret;
 
 	++p;
@@ -357,17 +357,13 @@ static gchar *entity_decode_numeric(gchar *str)
 	if (strlen(b) > 0)
 		c = g_ascii_strtoll (b, NULL, (hex ? 16 : 10));
 
-	if (c < 0) {
-		/* Obviously invalid */
-		debug_print("Numeric reference '&#%s;' is invalid\n", b);
-		return NULL;
-	} else if (c >= 0 && c <= 31) {
+	if (c >= 0 && c <= 31)
 		/* An unprintable character; return the Unicode replacement symbol */
 		return g_strdup("\xef\xbf\xbd");
-	} else if (c > 0x10ffff) {
-		/* Make sure the character falls within the Unicode codespace
-		 * (0x0 - 0x10ffff) */
-		debug_print("Numeric reference '&#%s;' is invalid, outside of Unicode codespace\n", b);
+
+	if (!g_unichar_validate(c)) {
+		/* Make sure the character is valid Unicode */
+		debug_print("Numeric reference '&#%s;' is invalid in Unicode codespace\n", b);
 		return NULL;
 	}
 

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list