summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2008-09-06 09:34:49 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2008-09-06 09:34:49 +0200
commitda3939cb10356c65d4ecaa378f0b22336c6bbb84 (patch)
tree7d3e63d477c094acc29a3b5fe0fdcec79ea357f2
parentde67eacbdaf3195a1d485680d7bb74dcc329589a (diff)
downloadvdr-da3939cb10356c65d4ecaa378f0b22336c6bbb84.tar.gz
vdr-da3939cb10356c65d4ecaa378f0b22336c6bbb84.tar.bz2
Fixed a possible integer overflow in GetAbsTime()
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY3
-rw-r--r--thread.c13
3 files changed, 10 insertions, 7 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 7b703b39..b9eb41f6 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1895,6 +1895,7 @@ Alexander Rieger <Alexander.Rieger@inka.de>
for fixing cTimer::operator=() in case a cTimer variable is assigned to itself
for making the list of tracks given in cStatus::SetAudioTrack() NULL terminated
for fixing handling kLeft in the calls to cStatus::MsgOsdTextItem()
+ for fixing a possible integer overflow in GetAbsTime()
Philip Prindeville <philipp_subx@redfish-solutions.com>
for updates to 'sources.conf'
diff --git a/HISTORY b/HISTORY
index 42cfb42e..97254857 100644
--- a/HISTORY
+++ b/HISTORY
@@ -5741,7 +5741,7 @@ Video Disk Recorder Revision History
- Increased the time between checking the CAM status to 500ms to avoid problems
with some CAMs (reported by Arthur Konovalov).
-2008-08-16: Version 1.6.0-2
+2008-09-06: Version 1.6.0-2
- Updated the Italian OSD texts (thanks to Diego Pierotto).
- The SVDRP signon message now indicates the character encoding in use, as in
@@ -5751,3 +5751,4 @@ Video Disk Recorder Revision History
- No longer calling FcFini() to avoid problems with older (broken) versions of
fontconfig (suggested by Edgar Toernig).
- Updated the sources.conf file (thanks to Oleg Roitburd).
+- Fixed a possible integer overflow in GetAbsTime() (thanks to Alexander Rieger).
diff --git a/thread.c b/thread.c
index 2d84918d..c9324687 100644
--- a/thread.c
+++ b/thread.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: thread.c 1.64 2008/02/15 14:17:42 kls Exp $
+ * $Id: thread.c 1.64.1.1 2008/08/16 11:00:40 kls Exp $
*/
#include "thread.h"
@@ -24,11 +24,12 @@ static bool GetAbsTime(struct timespec *Abstime, int MillisecondsFromNow)
{
struct timeval now;
if (gettimeofday(&now, NULL) == 0) { // get current time
- now.tv_usec += MillisecondsFromNow * 1000; // add the timeout
- while (now.tv_usec >= 1000000) { // take care of an overflow
- now.tv_sec++;
- now.tv_usec -= 1000000;
- }
+ now.tv_sec += MillisecondsFromNow / 1000; // add full seconds
+ now.tv_usec += (MillisecondsFromNow % 1000) * 1000; // add microseconds
+ if (now.tv_usec >= 1000000) { // take care of an overflow
+ now.tv_sec++;
+ now.tv_usec -= 1000000;
+ }
Abstime->tv_sec = now.tv_sec; // seconds
Abstime->tv_nsec = now.tv_usec * 1000; // nano seconds
return true;