Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/net/idna: Registration.ToASCII() accepts empty TLD label #47182

Open
Justin-Marks opened this issue Jul 14, 2021 · 1 comment
Open

x/net/idna: Registration.ToASCII() accepts empty TLD label #47182

Justin-Marks opened this issue Jul 14, 2021 · 1 comment

Comments

@Justin-Marks
Copy link

@Justin-Marks Justin-Marks commented Jul 14, 2021

What did you do?

https://play.golang.org/p/9qBLuOHAw3l

package main

import (
	"fmt"

	"golang.org/x/net/idna"
)

func main() {
    // invalid hostname; empty TLD label
	s := "golang.org.."

	ascii, err := idna.Registration.ToASCII(s)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(ascii)
}

What did you expect to see?

(error) idna: invalid label ""

What did you see instead?

"golang.org.."

This appears to happen only if the input is pure ASCII. If there's Unicode (eg, gólang.órg..) the result is an error as expected.

@cherrymui cherrymui added this to the Unreleased milestone Jul 14, 2021
@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Jul 14, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants