r5410 - trunk/varnish-cache/lib/libvmod_std

phk at varnish-cache.org phk at varnish-cache.org
Tue Oct 5 21:30:11 CEST 2010


Author: phk
Date: 2010-10-05 21:30:11 +0200 (Tue, 05 Oct 2010)
New Revision: 5410

Modified:
   trunk/varnish-cache/lib/libvmod_std/vmod_std.c
Log:
Ignore NULL pointers in vmod.to{upper|lower}()



Modified: trunk/varnish-cache/lib/libvmod_std/vmod_std.c
===================================================================
--- trunk/varnish-cache/lib/libvmod_std/vmod_std.c	2010-10-05 12:48:31 UTC (rev 5409)
+++ trunk/varnish-cache/lib/libvmod_std/vmod_std.c	2010-10-05 19:30:11 UTC (rev 5410)
@@ -55,11 +55,13 @@
 	e += u;
 	p = s;
 	while (p != vrt_magic_string_end && b < e) {
-		for (; b < e && *p != '\0'; p++)
-			if (up)
-				*b++ = toupper(*p);
-			else
-				*b++ = tolower(*p);
+		if (p != NULL) {
+			for (; b < e && *p != '\0'; p++)
+				if (up)
+					*b++ = toupper(*p);
+				else
+					*b++ = tolower(*p);
+		}
 		p = va_arg(ap, const char *);
 	}
 	if (b < e)




More information about the varnish-commit mailing list