curl-library
curl gmtime bug (fwd)
Date: Mon, 7 Feb 2011 13:49:51 +0100 (CET)
Hi
Here's a bug report from Andrew Kurushin, forwarded with permission.
/ daniel.haxx.se
---------- Forwarded message ----------
Date: Fri, 4 Feb 2011 09:12:44
From: Andrew Kurushin <ajax16384_at_gmail.com>
Subject: curl gmtime bug
Hello
Http.c Function Curl_add_timecondition contains AccessViolation bug:
gmtime (msvcrt implementation)- may return NULL for invalid input data, in
that case following "snprintf" generate AccessViolation.
Workaround:
#ifdef HAVE_GMTIME_R
/* thread-safe version */
struct tm keeptime;
tm = (struct tm *)gmtime_r(&data->set.timevalue, &keeptime);
#else
tm = gmtime(&data->set.timevalue);
#endif
if (tm == NULL) {
return result; //CURLE_OK. We do not need to abort request if conditional
time is invalid. We just process with unconditional request path
}
Thanks
Andrei
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-07