From 767f705096f8e9c3d93db41f9da0accb64753921 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 ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/081e35b3e5543a8145025432d939e530361ca25f Author: Stefan Seyfried Date: 2013-12-22 (Sun, 22 Dec 2013) --- 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