HomeFreeBSD

Set pca.p_bufr to NULL when we haven't allocated a buffer.
rS222804Unpublished

Unpublished Commit ยท Learn More

No further details are available.

Description

Set pca.p_bufr to NULL when we haven't allocated a buffer.

Otherwise, p_bufr is set to garbage on the stack, and if that garbage
happens to be non-NULL, and the TOLOG or TOCONS flag is set, putbuf()
will get called and attempt to fill the non-existent buffer.

This is really only relevant for tprintf() (and only when the priority is
not -1), but set it in uprintf() and ttyprintf() for completeness.

The next step, to avoid log buffer scrambling, would be to add the
PRINTF_BUFR_SIZE code to tprintf(), but this should prevent panics.

Submitted by: rmacklem
Found by: pho

Details

Provenance
kenAuthored on
Parents
rS222803: Lower WARNS level to 3 to eliminate alignment warnings related to
Branches
Unknown
Tags
Unknown

Event Timeline