From 3bb17fca04e792fe9668365e2c2af43fdbedafea Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Sun, 1 Apr 2012 16:26:44 +0200 Subject: [PATCH] gnutls: do not access unitialized variable. --- src/ChangeLog | 6 ++++++ src/gnutls.c | 12 ++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4d2dd711..d58b1520 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-04-01 Giuseppe Scrivano + + * gnutls.c (wgnutls_read_timeout): Do not use timer if it is not + allocated. + Reported by: Xu Zhongxing + 2012-03-30 Tim Ruehsen (tiny change) * warc.c: make warc_uuid_str() implementation depend on HAVE_LIBUUID. diff --git a/src/gnutls.c b/src/gnutls.c index 2a1d22b9..2db5a90c 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -1,5 +1,5 @@ /* SSL support via GnuTLS library. - Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software + Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of GNU Wget. @@ -160,9 +160,13 @@ wgnutls_read_timeout (int fd, char *buf, int bufsize, void *arg, double timeout) do { - double next_timeout = timeout - ptimer_measure (timer); - if (timeout && next_timeout < 0) - break; + double next_timeout; + if (timeout > 0.0) + { + next_timeout = timeout - ptimer_measure (timer); + if (next_timeout < 0.0) + break; + } ret = GNUTLS_E_AGAIN; if (timeout == 0 || gnutls_record_check_pending (ctx->session) -- 2.39.2