[PATCH v4l-utils] keytable: keymap without protocol is invalid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Without a protocol, keymap cannot be loaded and causes a segfault.

Reported-by: Camden Lindsay <camden.lindsay+kernel@xxxxxxxxx>
Signed-off-by: Sean Young <sean@xxxxxxxx>
---
 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;
-- 
2.24.1




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux