HomeFreeBSD

rs: Fix some pointer arith UB.

Description

rs: Fix some pointer arith UB.

If the next column was blank, then the length of the following entry
was computed as the end of the following entry minus a global variable
"blank" which is not in the same string or allocation. Instead, save
the start value of 'p' explicitly instead of abusing '*ep'. Possibly
we should just increment p before saving it in sp in the 'blank' case,
but at worst that would just mean maxlen might be one char too large
which should be harmless.

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D36832

(cherry picked from commit ba86cffb2840e12b5d72453d7c574850a76001d8)

Details

Provenance
jhbAuthored on Oct 5 2022, 11:48 PM
Reviewer
brooks
Differential Revision
D36832: rs: Fix some pointer arith UB.
Parents
rG59c1904fc214: rs: Fix a use after free.
Branches
Unknown
Tags
Unknown