1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

gnutls: do not access unitialized variable.

This commit is contained in:
Giuseppe Scrivano 2012-04-01 16:26:44 +02:00
parent 2541e0b579
commit 3bb17fca04
2 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2012-04-01 Giuseppe Scrivano <gscrivano@gnu.org>
* gnutls.c (wgnutls_read_timeout): Do not use timer if it is not
allocated.
Reported by: Xu Zhongxing <xu_zhong_xing@163.com>
2012-03-30 Tim Ruehsen <tim.ruehsen@gmx.de> (tiny change) 2012-03-30 Tim Ruehsen <tim.ruehsen@gmx.de> (tiny change)
* warc.c: make warc_uuid_str() implementation depend on HAVE_LIBUUID. * warc.c: make warc_uuid_str() implementation depend on HAVE_LIBUUID.

View File

@ -1,5 +1,5 @@
/* SSL support via GnuTLS library. /* 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. Foundation, Inc.
This file is part of GNU Wget. 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 do
{ {
double next_timeout = timeout - ptimer_measure (timer); double next_timeout;
if (timeout && next_timeout < 0) if (timeout > 0.0)
{
next_timeout = timeout - ptimer_measure (timer);
if (next_timeout < 0.0)
break; break;
}
ret = GNUTLS_E_AGAIN; ret = GNUTLS_E_AGAIN;
if (timeout == 0 || gnutls_record_check_pending (ctx->session) if (timeout == 0 || gnutls_record_check_pending (ctx->session)