[master] c11ac80 Avoid segfaulting if hitmiss or handling hasn't been set yet

Tollef Fog Heen tfheen at varnish-cache.org
Mon Jul 11 10:44:03 CEST 2011


commit c11ac805b50dcf77aac5d4ba3d210207924250bf
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Mon Jul 11 10:14:40 2011 +0200

    Avoid segfaulting if hitmiss or handling hasn't been set yet
    
    Fall back to "-" if the handling has not been decided yet.
    
    Fixes: #950
    Fixes: #944
    Fixes: #918

diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index 521d52e..969cc22 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -654,11 +654,11 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
 					p += 9+15;
 					break;
 				} else if (strncmp(what, "hitmiss}x", 9) == 0) {
-					fprintf(fo, "%s", lp->df_hitmiss);
+					fprintf(fo, "%s", (lp->df_hitmiss ? lp->df_hitmiss : "-"));
 					p += 9+8;
 					break;
 				} else if (strncmp(what, "handling}x", 10) == 0) {
-					fprintf(fo, "%s", lp->df_handling);
+					fprintf(fo, "%s", (lp->df_handling ? lp->df_handling : "-"));
 					p += 9+9;
 					break;
 				}



More information about the varnish-commit mailing list