nghttp2_bufs_remove: Prevent NULL from being passed to memcpy

This commit is contained in:
Tatsuhiro Tsujikawa 2014-05-11 13:51:46 +09:00
parent 6e7d0286e3
commit b187895e1d
1 changed files with 5 additions and 1 deletions

View File

@ -379,7 +379,11 @@ ssize_t nghttp2_bufs_remove(nghttp2_bufs *bufs, uint8_t **out)
for(chain = bufs->head; chain; chain = chain->next) {
buf = &chain->buf;
resbuf.last = nghttp2_cpymem(resbuf.last, buf->pos, nghttp2_buf_len(buf));
if(resbuf.last) {
resbuf.last = nghttp2_cpymem(resbuf.last,
buf->pos, nghttp2_buf_len(buf));
}
nghttp2_buf_reset(buf);
nghttp2_buf_shift_right(&chain->buf, bufs->offset);