Module Name:    src
Committed By:   shm
Date:           Fri Sep  8 14:34:02 UTC 2023

Modified Files:
        src/usr.bin/mail: format.c

Log Message:
Fix check_bufsize() incorrect behaviour

The function ensures that that buffer is large enough to store the data (if
not, it reallocates it). It doubled the buffer every time the buffer was too
small, but in some cases it wasn't enough, which might lead to heap overflows.
Rewrite of this function handles int overflow scenarios as well as ensures the
buffer is big enough to handle the data.

Thanks riastradh@ for the review and comments


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/mail/format.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Reply via email to