errlog: fix out-of-bounds read when resizing the print buffer

errlogBufResize copied the print buffer from &pvt.print->base (the
address of the char* field inside the buffer_t struct) instead of
pvt.print->base (the buffer it points to), reading bufSize bytes from an
~8-byte struct field.  Drop the stray & so it reads the actual buffer,
matching the adjacent log-buffer copy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jacqueline GarrahanandClaude Opus 4.8 authored and Andrew Johnson committed 2026-07-16 16:57:57 -05:00
1 parent 605542ece7
commit ec0ae7d831
1 file changed
+1 -1
+1 -1
View File
@@ -638,7 +638,7 @@ void errlogBufResize(struct initArgs config)
memcpy(logbuf, pvt.log->base, pvt.bufSize);
pvt.log->base = logbuf;
memcpy(printbuf, &pvt.print->base, pvt.bufSize);
memcpy(printbuf, pvt.print->base, pvt.bufSize);
pvt.print->base = printbuf;
pvt.bufSize = config.bufsize;