Squid 3.4.5 segfaults when formatting log lines for me. It looks like this is down to fmt->data.timespec being uninitialised, and affects the %tg format specifier.

As far as I can tell, fmt->data.timespec is never set anywhere, and we should probably be using fmt->data.string instead.

The attached patch removes timespec, fixing the segmentation fault.

I can't see any relevant code change between 3.4.4 and 3.4.5, so I'm guessing this may be down to the toolchain change. Presumably the compiler used to initialise the pointer to NULL and nolonger does.

--
 - Steve Hill
   Technical Director
   Opendium Limited     http://www.opendium.com

Direct contacts:
   Instant messager: xmpp:st...@opendium.com
   Email:            st...@opendium.com
   Phone:            sip:st...@opendium.com

Sales / enquiries contacts:
   Email:            sa...@opendium.com
   Phone:            +44-844-9791439 / sip:sa...@opendium.com

Support contacts:
   Email:            supp...@opendium.com
   Phone:            +44-844-4844916 / sip:supp...@opendium.com
Index: src/format/Token.h
===================================================================
--- src/format/Token.h	(revision 276)
+++ src/format/Token.h	(working copy)
@@ -49,7 +49,6 @@
             char *element;
             char separator;
         } header;
-        char *timespec;
     } data;
     int widthMin; ///< minimum field width
     int widthMax; ///< maximum field width
Index: src/format/Format.cc
===================================================================
--- src/format/Format.cc	(revision 276)
+++ src/format/Format.cc	(working copy)
@@ -475,7 +475,7 @@
             const char *spec;
 
             struct tm *t;
-            spec = fmt->data.timespec;
+            spec = fmt->data.string;
 
             if (fmt->type == LFT_TIME_LOCALTIME) {
                 if (!spec)

Reply via email to