From fc478d0ee18db7e67f8f4d53dcd3412d74dd3cb0 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 22 Dec 2013 22:23:41 +0100 Subject: [PATCH] rcinput: avoid theoretically possible timerid overflow Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/081e35b3e5543a8145025432d939e530361ca25f Author: Stefan Seyfried Date: 2013-12-22 (Sun, 22 Dec 2013) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/rcinput.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index a961282bc..6f2344c7a 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -350,6 +350,11 @@ int CRCInput::addTimer(uint64_t Interval, bool oneshot, bool correct_time ) _newtimer.interval = 0; _newtimer.id = timerid++; + /* in theory, this uint32_t could overflow... */ + /* ...and timerid == 0 is used as "no timer" in many places. */ + if (timerid == 0) + timerid++; + if ( correct_time ) _newtimer.times_out = timeNow+ Interval; else