Received: from eggs.gnu.org ([2001:4830:134:3::10]:56428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2C9A-0005yg-At for qemu-devel@nongnu.org; Thu, 03 Nov 2016 03:09:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c2C97-0005nK-5u for qemu-devel@nongnu.org; Thu, 03 Nov 2016 03:09:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39022) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c2C97-0005mJ-0k for qemu-devel@nongnu.org; Thu, 03 Nov 2016 03:09:09 -0400 From: Markus Armbruster References: <1478152560-24740-1-git-send-email-wangxinxin.wang@huawei.com> <7d02cdc1-44bc-590d-4eae-a23d6e38ee2e@msgid.tls.msk.ru> Date: Thu, 03 Nov 2016 08:09:05 +0100 In-Reply-To: <7d02cdc1-44bc-590d-4eae-a23d6e38ee2e@msgid.tls.msk.ru> (Michael Tokarev's message of "Thu, 3 Nov 2016 09:30:46 +0300") Message-ID: <878tt159bi.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] keyboard: fix qemu load empty keymap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: Wang Xin , qemu-devel@nongnu.org Michael Tokarev writes: > 03.11.2016 08:56, Wang Xin wrote: >> qemu_find_file do not check file is a directory or just a file. >> If qemu start with "-k ''", qemu_find_file get a empty string >> as keymap file name, then, qemu treat the keymap path as keymap >> file, it makes vnc keyboard input unusable. > > Do we really care? "Garbage in, garbage out" I'd say :) Moreover, are you really, really sure qemu_find_file() is never used to find a directory? Outside the scope of the patch: qemu_find_file() is basically a bad idea. By the time the file name it computes gets used, the file it found may be gone, or have become a directory (TOCTTOU). The proper fix for -k '' breaking the keyboard would be to make -k reject garbage input. Have a look at parse_keyboard_layout() and weep.