Escape @ when printing/unpacking domain names

This commit is contained in:
Andrew Tunnell-Jones 2014-03-01 22:30:52 +00:00
parent 3ba746b6ca
commit 38d78bafe4
2 changed files with 2 additions and 2 deletions

2
msg.go
View File

@ -403,7 +403,7 @@ Loop:
}
for j := off; j < off+c; j++ {
switch b := msg[j]; b {
case '.', '(', ')', ';', ' ':
case '.', '(', ')', ';', ' ', '@':
fallthrough
case '"', '\\':
s = append(s, '\\', b)

View File

@ -480,7 +480,7 @@ func sprintTxt(txt []string) string {
}
func appendDomainNameByte(s []byte, b byte) []byte {
if b == '.' || b == '(' || b == ')' || b == ';' || b == ' ' || b == '\'' {
if b == '.' || b == '(' || b == ')' || b == ';' || b == ' ' || b == '\'' || b == '@' {
return append(s, '\\', b)
}
return appendTXTStringByte(s, b)