Hello,

I got "UnicodeError: label empty or too long" on some messages in history. Actual crash happens in idn_to_ascii:


File "/usr/local/share/gajim/src/common/helpers.py", line 125, in idn_to_ascii
     converted_labels.append(idna.ToASCII(label))
   File "/usr/local/lib/python2.7/encodings/idna.py", line 73, in ToASCII
     raise UnicodeError("label empty or too long")

Patch attached fixing it (just be sure that label is not empty before calling idna.ToASCII()).

--
Regards,
Ruslan

T.O.S. Of Reality

diff --git a/helpers.py.orig b/helpers.py
index 9c46cc9..48947fc 100644
--- a/helpers.py.orig
+++ b/helpers.py
@@ -122,7 +122,8 @@ def idn_to_ascii(host):
     labels = idna.dots.split(host)
     converted_labels = []
     for label in labels:
-        converted_labels.append(idna.ToASCII(label))
+        if label:
+            converted_labels.append(idna.ToASCII(label))
     return ".".join(converted_labels)
 
 def ascii_to_idn(host):
_______________________________________________
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel

Reply via email to