Permalink
Browse files

Fix an off-by one causing extremely rare asserts: We must have two

free slots, one for the data we want to write and one for the
end of chunk bits.

Fixes: #2207
  • Loading branch information...
1 parent 6440798 commit a6696fc0813c8a8c1519a4ebceea25720f8f7836 @bsdphk bsdphk committed Feb 15, 2017
Showing with 1 addition and 1 deletion.
  1. +1 −1 bin/varnishd/http1/cache_http1_line.c
@@ -239,7 +239,7 @@ V1L_Write(const struct worker *wrk, const void *ptr, ssize_t len)
return (0);
if (len == -1)
len = strlen(ptr);
- if (v1l->niov >= v1l->siov - (v1l->ciov < v1l->siov ? 1 : 0))
+ if (v1l->niov >= v1l->siov - (v1l->ciov < v1l->siov ? 2 : 0))
(void)V1L_Flush(wrk);
v1l->iov[v1l->niov].iov_base = TRUST_ME(ptr);
v1l->iov[v1l->niov].iov_len = len;

0 comments on commit a6696fc

Please sign in to comment.