[master] b498b6d Add some asserts to ensure we catch NULL pointers.

Poul-Henning Kamp phk at FreeBSD.org
Fri May 5 23:35:05 CEST 2017


commit b498b6d02862262463790bfbc1ba990839c2f3b0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri May 5 21:29:35 2017 +0000

    Add some asserts to ensure we catch NULL pointers.

diff --git a/lib/libvarnishapi/vsl_arg.c b/lib/libvarnishapi/vsl_arg.c
index 0ab5679..e811ca0 100644
--- a/lib/libvarnishapi/vsl_arg.c
+++ b/lib/libvarnishapi/vsl_arg.c
@@ -199,6 +199,7 @@ VSLQ_Name2Grouping(const char *name, int l)
 {
 	int i, n;
 
+	AN(name);
 	if (l == -1)
 		l = strlen(name);
 	n = -1;
@@ -264,6 +265,7 @@ vsl_IX_arg(struct VSL_data *vsl, int opt, const char *arg)
 	struct vbitmap *tags = NULL;
 
 	CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC);
+	AN(arg);
 	vsl->flags |= F_SEEN_ixIX;
 
 	b = arg;
@@ -337,6 +339,7 @@ VSL_Arg(struct VSL_data *vsl, int opt, const char *arg)
 	case 'i': case 'x': return (vsl_ix_arg(vsl, opt, arg));
 	case 'I': case 'X': return (vsl_IX_arg(vsl, opt, arg));
 	case 'L':
+		AN(arg);
 		l = strtol(arg, &p, 0);
 		while (isspace(*p))
 			p++;
@@ -347,6 +350,7 @@ VSL_Arg(struct VSL_data *vsl, int opt, const char *arg)
 		vsl->L_opt = (int)l;
 		return (1);
 	case 'T':
+		AN(arg);
 		d = VNUM(arg);
 		if (isnan(d))
 			return (vsl_diag(vsl, "-T: Syntax error"));



More information about the varnish-commit mailing list