From bfd9c629639029d51cfda610eab6bce434db598b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vuchener?= Date: Wed, 16 Sep 2015 21:14:04 +0200 Subject: [PATCH] Abort when the report id is invalid --- src/hidpp10.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hidpp10.c b/src/hidpp10.c index 073d5bcc..ee0db4d5 100644 --- a/src/hidpp10.c +++ b/src/hidpp10.c @@ -111,7 +111,7 @@ hidpp10_request_command(struct hidpp10_device *dev, union hidpp10_message *msg) union hidpp10_message expected_error_dev = ERROR_MSG(msg, msg->msg.device_idx); int ret; uint8_t hidpp_err = 0; - int command_size = 0; + int command_size; switch (msg->msg.report_id) { case REPORT_ID_SHORT: @@ -120,6 +120,8 @@ hidpp10_request_command(struct hidpp10_device *dev, union hidpp10_message *msg) case REPORT_ID_LONG: command_size = LONG_MESSAGE_LENGTH; break; + default: + abort(); } /* create the expected header */