From d72603665c547ff7d4e2deab1735bbfb90c0a780 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 14 Nov 2014 23:38:52 +0100 Subject: [PATCH] CComponentsForm: prevent wrong id parameter if item size out of range --- src/gui/components/cc_frm.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index cf40cc7d1..3c5c76113 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -250,6 +250,11 @@ int CComponentsForm::genIndex() CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id) { + if (cc_item_id >= size()){ + dprintf(DEBUG_NORMAL, "[CComponentsForm] [%s - %d] Error: parameter cc_item_id = %u, out of range (size = %u)...\n", __func__, __LINE__, cc_item_id, size()); + return NULL; + } + if (v_cc_items[cc_item_id]) return v_cc_items[cc_item_id]; return NULL;