mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-24 00:59:19 +02:00
#40, fix dots in hostname when length is 113, 170, 227... Includes test.
This commit is contained in:
parent
fba7afc83c
commit
4dcdd31e3c
|
@ -52,12 +52,12 @@ inline_dotify(char *buf, size_t buflen)
|
||||||
pos = (unsigned) (reader - buf) + 1;
|
pos = (unsigned) (reader - buf) + 1;
|
||||||
|
|
||||||
while (dots) {
|
while (dots) {
|
||||||
|
*writer-- = *reader--;
|
||||||
|
pos--;
|
||||||
if (pos % 57 == 0) {
|
if (pos % 57 == 0) {
|
||||||
*writer-- = '.';
|
*writer-- = '.';
|
||||||
dots--;
|
dots--;
|
||||||
}
|
}
|
||||||
*writer-- = *reader--;
|
|
||||||
pos--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return new length of string */
|
/* return new length of string */
|
||||||
|
|
|
@ -31,6 +31,8 @@ struct tuple
|
||||||
"aaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaa"},
|
"aaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaa"},
|
||||||
{ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
{ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."},
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."},
|
||||||
|
{ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||||
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
|
||||||
{ "abc123", "abc123" },
|
{ "abc123", "abc123" },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue