avoid overflowing a time_t when converting timeval to a timestamp in

milliseconds.

problem found and fix sent upstream by Mark Peloquin, who notified the
port maintainer.  thanks Mark!

this patch is from brad@ (MAINTAINER) via ktorrent svn
This commit is contained in:
jakemsr 2008-04-01 21:22:10 +00:00
parent 71cb80234a
commit 6fcdd6f95b
2 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.8 2008/02/05 19:17:15 naddy Exp $
# $OpenBSD: Makefile,v 1.9 2008/04/01 21:22:10 jakemsr Exp $
SHARED_ONLY= Yes
@ -6,7 +6,7 @@ COMMENT= BitTorrent client for KDE
VERSION= 2.2.5
DISTNAME= ktorrent-${VERSION}
PKGNAME= ${DISTNAME}p0
PKGNAME= ${DISTNAME}p1
CATEGORIES= net x11 x11/kde
EXTRACT_SUFX= .tar.bz2

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-libktorrent_util_functions_cpp,v 1.1 2008/04/01 21:22:10 jakemsr Exp $
--- libktorrent/util/functions.cpp.orig Mon Mar 31 20:18:16 2008
+++ libktorrent/util/functions.cpp Mon Mar 31 20:25:06 2008
@@ -178,7 +178,7 @@ namespace bt
{
struct timeval tv;
gettimeofday(&tv,0);
- global_time_stamp = (Uint64)(tv.tv_sec * 1000 + tv.tv_usec * 0.001);
+ global_time_stamp = (Uint64)tv.tv_sec * 1000 + (Uint64)tv.tv_usec * 0.001;
return global_time_stamp;
}