summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2026-04-20 12:35:06 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2026-04-20 12:38:51 +0200
commit857e549307fed893145bbab72ddd3fe08833c8c4 (patch)
treebfab850319468e0a218d86579c4eeaf14ec716c5
parentexamples: remove (diff)
downloadwireguard-windows-pkg/walk.tar.xz
wireguard-windows-pkg/walk.zip
commondialogs: match full width '|'pkg/walk
A bug was encountered in the localization from: Configuration Files (*.zip, *.conf)|*.zip;*.conf|All Files (*.*)|*.* to: 구성 파일 (*.zip, *.conf)|*.zip;*.conf|All Files (*.*)|*.* Converting the latter into utf16 yields this sequence: 00000000 6c ad 31 c1 20 00 0c d3 7c c7 20 00 28 00 2a 00 |l.1. ...|. .(.*.| 00000010 2e 00 7a 00 69 00 70 00 2c 00 20 00 2a 00 2e 00 |..z.i.p.,. .*...| 00000020 63 00 6f 00 6e 00 66 00 29 00 7c 00 2a 00 2e 00 |c.o.n.f.).|.*...| 00000030 7a 00 69 00 70 00 3b 00 2a 00 2e 00 63 00 6f 00 |z.i.p.;.*...c.o.| 00000040 6e 00 66 00 7c 00 41 00 6c 00 6c 00 20 00 46 00 |n.f.|.A.l.l. .F.| 00000050 69 00 6c 00 65 00 73 00 20 00 28 00 2a 00 2e 00 |i.l.e.s. .(.*...| 00000060 2a 00 29 00 7c 00 2a 00 2e 00 2a 00 |*.).|.*...*.| Notice on the top line, 0x7c, which is '|'. The old code thus replaced 7c c7 with 00 00, because it cast each utf16 character to a single byte before doing the comparison. Fix this by instead comparing the full utf16 character against the the utf16 representation of '|', 7c 00. Reported-by: 오한웅 <oho790114@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--commondialogs.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/commondialogs.go b/commondialogs.go
index df523ce8..462dd615 100644
--- a/commondialogs.go
+++ b/commondialogs.go
@@ -40,7 +40,7 @@ func (dlg *FileDialog) show(owner Form, fun func(ofn *win.OPENFILENAME) bool, fl
copy(filter, syscall.StringToUTF16(dlg.Filter))
// Replace '|' with the expected '\0'.
for i, c := range filter {
- if byte(c) == '|' {
+ if c == uint16('|') {
filter[i] = uint16(0)
}
}