Skip to content

Commit d2c82b2

Browse files
authored
Clear the right number of bytes in StreamBuffer
The wrong number of bytes was being cleared in StreamBuffer::grow. That could lead to memory access out of bounds.
1 parent 211f689 commit d2c82b2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/StreamBuffer.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ grow(size_t minsize)
144144
// just move contents to start of buffer and clear end
145145
// to avoid reallocation
146146
memmove(buffer, buffer+offs, len);
147-
memset(buffer+len, 0, offs);
147+
memset(buffer+len, 0, cap-offs-len);
148148
offs = 0;
149149
return;
150150
}

0 commit comments

Comments
 (0)