Is the co-pilot itself performance-sensitive?
Is the co-pilot itself performance-sensitive?
Posted Sep 22, 2024 19:10 UTC (Sun) by rweikusat2 (subscriber, #117920)In reply to: Is the co-pilot itself performance-sensitive? by geofft
Parent article: pcp: pmcd network daemon review (SUSE Security Team Blog)
- if (vindex < 0 || vindex > pdulen) {
+ if (vindex < 0 || (char *)&pdubuf[vindex] >= pduend) {
The first (original line) is the wrong comparison. It's wrong because vindex is used to index an array of __mPDU (32 bit with current definition) and not bytes. Correct code would be
if (vindex < 0 || vindex > pdulen / sizeof(__pmPDU)) {
The SUSE fix calculates the address the array element at position vindex would correspond to and compares that with the end of the received data. The expression
pdubuf[vindex]
is defined to be identical to
*(pdubuf + vindex)
6.5.6|8 states that, for such an addition
If both the pointer operand and the result point to elements of the same array object, or one past
the last element of the array object, the evaluation shall not produce an overflow; otherwise, the
behavior is undefined.
The behaviour of the SUSE code is thus undefined in case vindex is actually out of bounds by more than one.
:-)
