From b8a771bf3b3115c5d14dcf6fbb03d0bc02a7a0d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Sat, 23 Feb 2008 10:58:43 +0000 Subject: [PATCH] Make this pass the test cases again. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22620 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/wind/punycode.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/wind/punycode.c b/lib/wind/punycode.c index 0e4544520..4746e9760 100644 --- a/lib/wind/punycode.c +++ b/lib/wind/punycode.c @@ -108,22 +108,20 @@ wind_punycode_label_toascii(const uint32_t *in, size_t in_len, out[o++] = in[i]; } } - if (o == i) { - *out_len = o; - return 0; - } b = h; if (b > 0) { if (o >= *out_len) return WIND_ERR_OVERRUN; out[o++] = 0x2D; } - - if (o + 4 >= *out_len) - return WIND_ERR_OVERRUN; - memmove(out + 4, out, o); - memcpy(out, "xn--", 4); - o += 4; + /* is this string punycoded */ + if (h < in_len) { + if (o + 4 >= *out_len) + return WIND_ERR_OVERRUN; + memmove(out + 4, out, o); + memcpy(out, "xn--", 4); + o += 4; + } while (h < in_len) { m = (unsigned)-1;