[master] d246d52 Remember to actually record the length of variable length attributes

Martin Blix Grydeland martin at varnish-software.com
Mon May 8 14:56:06 CEST 2017


commit d246d525978363ae778dc5b793e1b201714b4080
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Mon May 8 14:28:55 2017 +0200

    Remember to actually record the length of variable length attributes
    
    A variable length attribute (OA_HEADERS and OA_VARY) are allowed to be
    overwritten if the new data has the exact same length as the previous
    data. To check this, its length is recorded. But the length wasn't
    recorded, and the code would treat it as a new attribute.
    
    The reason this hasn't caused issues is that the code looking at
    OA_HEADERS and OA_VARY ignores the stored attribute length, and that
    these aren't ever overwritten.

diff --git a/bin/varnishd/storage/storage_simple.c b/bin/varnishd/storage/storage_simple.c
index c3bffe9..aaf2c48 100644
--- a/bin/varnishd/storage/storage_simple.c
+++ b/bin/varnishd/storage/storage_simple.c
@@ -585,6 +585,7 @@ sml_setattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr,
 			assert(st->len + len <= st->space);		\
 			o->va_##l = st->ptr + st->len;			\
 			st->len += len;					\
+			o->va_##l##_len = len;				\
 			retval = o->va_##l;				\
 		}							\
 		break;



More information about the varnish-commit mailing list