HomeFreeBSD

Fix broken pointer overflow check ns_name_unpack()

Description

Fix broken pointer overflow check ns_name_unpack()

Many compilers may optimize away the overflow check `msg + l < msg',
where msg' is a pointer and l' is an integer, because pointer
overflow is undefined behavior in C.

Use a safe precondition test `l >= eom - msg' instead.

Reference:
https://android-review.googlesource.com/#/c/50570/

Obtained from: NetBSD (CVS rev. 1.10)
MFC after: 3 weeks

Details

Provenance
pfgAuthored on Aug 7 2014, 4:40 PM
Parents
rG046c3635cdb2: Bring final version of libbind:
Branches
Unknown
Tags
Unknown

Event Timeline