You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Paul J. Reder" <re...@raleigh.ibm.com> on 2000/01/13 20:38:42 UTC

[Patch]: timestr.c initialization of time struck to avoid segfault

mod_rewrite was segfaulting in its logging routines because
during the call to ap_strftime the struct was not fully initialized.
A garbage pointer was passed the the system call causing a segfault.

This solves that problem by memsetting the struct before the 
members are initialized.

-- 
Paul J. Reder
------------------------------------------------------------
"Remember, Information is not knowledge; Knowledge is not Wisdom;
Wisdom is not truth; Truth is not beauty; Beauty is not love;
Love is not music; Music is the best." -- Frank Zappa


Index: timestr.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/time/unix/timestr.c,v
retrieving revision 1.5
diff -u -r1.5 timestr.c
--- timestr.c   2000/01/09 05:18:21     1.5
+++ timestr.c   2000/01/13 19:37:37
@@ -53,6 +53,8 @@
  *
  */
 
+#include <string.h>
+
 #include "atime.h"
 #include "apr_portable.h"
 
@@ -160,6 +162,7 @@
 {
     struct tm tm;
 
+    memset (&tm, 0, sizeof (struct tm));
     tm.tm_sec  = xt->tm_sec;
     tm.tm_min  = xt->tm_min;
     tm.tm_hour = xt->tm_hour;