From fe3269e9ef59b03e7b13f5eefc996180dbedc60a Mon Sep 17 00:00:00 2001 From: Gregg Date: Mon, 15 Apr 2024 22:14:05 -0500 Subject: [PATCH] Added new validation check for homeSpan.resetIID() New value must be equal to, or greater than, the last IID value used. This prevents possible re-use. --- src/HomeSpan.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp index b0bcbe7..9380bd7 100644 --- a/src/HomeSpan.cpp +++ b/src/HomeSpan.cpp @@ -1594,13 +1594,15 @@ Span& Span::resetIID(int newIID){ while(1); } - if(newIID<1){ - LOG0("\nFATAL ERROR! Can't reset the Accessory IID count to a value less than 1 ***\n"); + newIID--; + + if(newIIDiidCount){ + LOG0("\nFATAL ERROR! Can't reset the Accessory IID count to a value less than already used ***\n"); LOG0("\n=== PROGRAM HALTED ==="); while(1); } - Accessories.back()->iidCount=newIID-1; + Accessories.back()->iidCount=newIID; return(*this); }