mirror of https://github.com/ipxe/ipxe.git
[dns] Allow trailing dots in DNS names
Reported-by: Christian Hesse <list@eworm.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/5/head
parent
55f6c88a27
commit
187cd80106
|
@ -222,18 +222,24 @@ static char * dns_qualify_name ( const char *string ) {
|
||||||
* DNS names consist of "<length>element" pairs.
|
* DNS names consist of "<length>element" pairs.
|
||||||
*/
|
*/
|
||||||
static char * dns_make_name ( const char *string, char *buf ) {
|
static char * dns_make_name ( const char *string, char *buf ) {
|
||||||
char *length_byte = buf++;
|
char *length_byte;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
while ( ( c = *(string++) ) ) {
|
length_byte = buf++;
|
||||||
if ( c == '.' ) {
|
*length_byte = 0;
|
||||||
*length_byte = buf - length_byte - 1;
|
do {
|
||||||
length_byte = buf;
|
c = *(string++);
|
||||||
|
if ( ( c == '.' ) || ( c == '\0' ) ) {
|
||||||
|
if ( *length_byte ) {
|
||||||
|
length_byte = buf++;
|
||||||
|
*length_byte = 0;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
*(buf++) = c;
|
*(buf++) = c;
|
||||||
|
(*length_byte)++;
|
||||||
}
|
}
|
||||||
*length_byte = buf - length_byte - 1;
|
} while ( c );
|
||||||
*(buf++) = '\0';
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue