From dc17bc69fe8e5e5a707913400f9501069729189f Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Fri, 16 Jan 2009 18:51:54 +0000 Subject: [PATCH] #40, fix dots in hostname when length is 113, 170, 227... Includes test. --- src/encoding.c | 4 ++-- tests/encoding.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/encoding.c b/src/encoding.c index 7f4c924..6878e5e 100644 --- a/src/encoding.c +++ b/src/encoding.c @@ -52,12 +52,12 @@ inline_dotify(char *buf, size_t buflen) pos = (unsigned) (reader - buf) + 1; while (dots) { + *writer-- = *reader--; + pos--; if (pos % 57 == 0) { *writer-- = '.'; dots--; } - *writer-- = *reader--; - pos--; } /* return new length of string */ diff --git a/tests/encoding.c b/tests/encoding.c index 7b256bd..a5d04fa 100644 --- a/tests/encoding.c +++ b/tests/encoding.c @@ -31,6 +31,8 @@ struct tuple "aaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaa"}, { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."}, + { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, { "abc123", "abc123" }, { NULL, NULL } };