Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
syscalls/sockioctl: Make buf a struct ifreq array
In setup3, the following line can lead to an undefined behavior: ifr = *(struct ifreq *)ifc.ifc_buf; Indeed, at this point it can be assumed that ifc.ifc_buf is suitably aligned for struct ifreq. However, ifc.ifc_buf is assigned to buf, a char array, which has no alignment constraints. This means there exists cases where buf is not suitably aligned to load a struct ifreq, which can generate a SIGBUS. Change buf from a char to a struct ifreq array, as it isn't used for anything else in this test. This guarantees that buff will be properly aligned. Reviewed-by: Li Wang <[email protected]> Reviewed-by: Petr Vorel <[email protected]> Reviewed-by: Cyril Hrubis <[email protected]> Signed-off-by: Teo Couprie Diaz <[email protected]>
- Loading branch information