* attempt to fix pecl Bug #16826 http_date strange behavior and crash
[m6w6/ext-http] / http_date_api.c
index e750a4da49863cec0d1077bd580ba5073dd84309..e6fd511552eef3a0404dd0a84b76a893ef1c5f16 100644 (file)
@@ -6,7 +6,7 @@
     | modification, are permitted provided that the conditions mentioned |
     | in the accompanying LICENSE file are met.                          |
     +--------------------------------------------------------------------+
-    | Copyright (c) 2004-2006, Michael Wallner <mike@php.net>            |
+    | Copyright (c) 2004-2007, Michael Wallner <mike@php.net>            |
     +--------------------------------------------------------------------+
 */
 
@@ -142,8 +142,9 @@ static inline int check_tzone(const char *tzone)
 PHP_HTTP_API char *_http_date(time_t t TSRMLS_DC)
 {
        char *date = NULL;
-       struct tm *gmtime, tmbuf;
+       struct tm *gmtime = NULL, tmbuf;
 
+       memset(&tmbuf, 0, sizeof(tmbuf));
        if ((gmtime = php_gmtime_r(&t, &tmbuf))) {
                spprintf(&date, 0,
                        "%s, %02d %s %04d %02d:%02d:%02d GMT",