Adjust the sopt_val pointer on bigendian systems (e.g. MIPS64EB).
sooptcopyin() checks if size of data provided by user is <= than we can accept, else it strips down the size. On bigendian platforms we have to move pointer as well so we copy the actual data. Reviewed by: gnn Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D7980
This commit is contained in:
parent
2885e9e8b7
commit
30f3bfe58e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=306186
@ -2455,8 +2455,12 @@ sooptcopyin(struct sockopt *sopt, void *buf, size_t len, size_t minlen)
|
||||
*/
|
||||
if ((valsize = sopt->sopt_valsize) < minlen)
|
||||
return EINVAL;
|
||||
if (valsize > len)
|
||||
if (valsize > len) {
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
sopt->sopt_val = (void *)((uintptr_t)sopt->sopt_val + (valsize - len));
|
||||
#endif
|
||||
sopt->sopt_valsize = valsize = len;
|
||||
}
|
||||
|
||||
if (sopt->sopt_td != NULL)
|
||||
return (copyin(sopt->sopt_val, buf, valsize));
|
||||
|
Loading…
Reference in New Issue
Block a user