From 81ad9712fa981cb18e80cfbea529c27dda9bc7c5 Mon Sep 17 00:00:00 2001 From: "Guilherme G. Menaldo" Date: Sat, 3 Aug 2024 01:35:34 -0300 Subject: [PATCH] Add alert when plugins defines packets out of the accepted range this makes addPacket macro for HPM plugins to properly alert users when their packets are ignored due to being out of the supported range, this was previously silently ignored --- src/common/HPM.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/common/HPM.c b/src/common/HPM.c index 9608eec218e..3fc3c04a8d8 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -190,6 +190,9 @@ static bool hplugins_addpacket(unsigned short cmd, unsigned short length, void ( if (cmd <= MAX_PACKET_DB && cmd >= MIN_PACKET_DB) { packets->db[cmd] = length; + } else { + ShowError("HPM->addPacket:%s: packet 0x%04x is out of range! Packet ID must be between 0x%04x (MIN_PACKET_DB) and 0x%04x (MAX_PACKET_DB). Ignoring it...\n", + HPM->pid2name(pluginID), cmd, (unsigned int) MIN_PACKET_DB, (unsigned int) MAX_PACKET_DB); } return true;