dhcp-transport: fix out-of-bounds access
PATCH 1/1 dhcp-transport: fix out-of-bounds access
If len was odd the iovec was getting accessed out of bounds. 'j' needed to be decremented after the for loop. In addition, the iov_len was not being used to access the last byte of iov_base.
--- ell/dhcp-transport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
ell/dhcp-transport.c +3 -1
@@ -78,9 +78,11 @@ uint16_t _dhcp_checksumv(const struct iovec *iov, size_t iov_cnt) sum += check[i]; } + j--; +if (len &0x01 ) {const uint8_t *odd = iov[j].iov_base; - sum += odd[len -1 ]; + sum += odd[iov[j].iov_len -1 ]; }while (sum >>16 )
Signature · 1 line
2.21.0
Denis Kenzior
AppliedHi James,
Quoted 6 lines · James Prestwood
If len was odd the iovec was getting accessed out of bounds. 'j' needed to be decremented after the for loop. In addition, the
iov_lenwas not being used to access the last byte ofiov_base.--- ell/dhcp-transport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Applied, thanks.
Regards,
-Denis