From fcca903ae95cf652538ff2ec2c25a37935b2eca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Tue, 16 Jun 2020 02:39:15 +0200 Subject: [PATCH] allow only a-zA-Z for keyboard layout --- server/internal/xorg/xorg.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/internal/xorg/xorg.go b/server/internal/xorg/xorg.go index 8ff53f1..200294c 100644 --- a/server/internal/xorg/xorg.go +++ b/server/internal/xorg/xorg.go @@ -13,6 +13,7 @@ import ( "sync" "time" "unsafe" + "regexp" "n.eko.moe/neko/internal/types" ) @@ -214,6 +215,10 @@ func SetKeyboard(layout string) { mu.Lock() defer mu.Unlock() + if !regexp.MustCompile(`^[a-zA-Z]+$`).MatchString(layout) { + return + } + layoutUnsafe := C.CString(layout) defer C.free(unsafe.Pointer(layoutUnsafe))