From patchwork Tue Jan 21 16:52:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 11344249 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D6F213A4 for ; Tue, 21 Jan 2020 16:52:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6555924653 for ; Tue, 21 Jan 2020 16:52:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729085AbgAUQwO (ORCPT ); Tue, 21 Jan 2020 11:52:14 -0500 Received: from gofer.mess.org ([88.97.38.141]:51785 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726555AbgAUQwN (ORCPT ); Tue, 21 Jan 2020 11:52:13 -0500 Received: by gofer.mess.org (Postfix, from userid 1000) id BA174C635E; Tue, 21 Jan 2020 16:52:12 +0000 (GMT) From: Sean Young To: linux-media@vger.kernel.org Cc: Camden Lindsay Subject: [PATCH v4l-utils] keytable: keymap without protocol is invalid Date: Tue, 21 Jan 2020 16:52:12 +0000 Message-Id: <20200121165212.441-1-sean@mess.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Without a protocol, keymap cannot be loaded and causes a segfault. Reported-by: Camden Lindsay Signed-off-by: Sean Young --- utils/common/keymap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/common/keymap.c b/utils/common/keymap.c index d06deb59..6ca33745 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -169,6 +169,11 @@ static error_t parse_plain_keymap(char *fname, struct keymap **keymap, bool verb } fclose(fin); + if (!map->protocol) { + fprintf(stderr, _("Missing protocol in %s\n"), fname); + return EINVAL; + } + *keymap = map; return 0;