[sssd PR#743][opened] lib/cifs_idmap_sss: fixed unaligned mem access
by alexey-tikhonov
URL: https://github.com/SSSD/sssd/pull/743
Author: alexey-tikhonov
Title: #743: lib/cifs_idmap_sss: fixed unaligned mem access
Action: opened
PR body:
"""
Fixed following warning:
```
lib/cifs_idmap_sss/cifs_idmap_sss.c: In function ‘sss_sid_to_id’:
lib/cifs_idmap_sss/cifs_idmap_sss.c:221:47: warning: taking address
of packed member of ‘struct cifs_uxid’ may result in an unaligned
pointer value [-Waddress-of-packed-member]
err = sss_nss_getidbysid(sid, (uint32_t *)&cuxid->id.uid, &id_type);
```
Actually there are two issues:
1) Packed `cifs_uxid::id.uid` may be unaligned thus generating run time
error on some architectures (as compiler complains);
2) In theory size of `uid_t` may be different than size of `uint32_t`
thus resulting in corruption of `cifs_uxid` content.
Proposed patch is not ideal due to `(uid_t)uid` cast but solves most
of issues with minimal effor. Proper solution would require patching of
`sss_nss_getidbysid()` and all underlying functions for no good reason.
"""
To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/743/head:pr743
git checkout pr743
5 years, 2 months