Skip to content

Commit

Permalink
Avoid buffer read overflow on vcl_error and -sfile
Browse files Browse the repository at this point in the history
The file stevedore may return a buffer larger than asked for when
requesting storage. Due to lack of check for this condition, the code
to copy the synthetic error memory buffer from vcl_error would overrun
the buffer.

Patch by @shamger

Fixes: #2429
  • Loading branch information
mbgrydeland committed Sep 19, 2017
1 parent b5593e2 commit 176f8a0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/varnishd/cache/cache_fetch.c
Expand Up @@ -899,6 +899,8 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
l = ll;
if (VFP_GetStorage(bo->vfc, &l, &ptr) != VFP_OK)
break;
if (l > ll)
l = ll;
memcpy(ptr, VSB_data(synth_body) + o, l);
VFP_Extend(bo->vfc, l);
ll -= l;
Expand Down

0 comments on commit 176f8a0

Please sign in to comment.