Skip to content

Commit 95ef484

Browse files
guarding against non-ASCII ISO codes (#247)
1 parent 5cc734b commit 95ef484

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

cmd/tcg/data.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,8 @@ func countryFlag(isoCode string) string {
5353
if len(code) != 2 {
5454
return ""
5555
}
56+
if code[0] < 'A' || code[0] > 'Z' || code[1] < 'A' || code[1] > 'Z' {
57+
return ""
58+
}
5659
return string(rune(0x1F1E6+(rune(code[0])-'A'))) + string(rune(0x1F1E6+(rune(code[1])-'A')))
5760
}

0 commit comments

Comments
 (0)