Revert r306186 ("Adjust the sopt_val pointer on bigendian systems").

This logic doesn't work with bigger sopt_valsize (e.g. when ipfw
passing 2048 bytes rule).

Reported by:	adrian
Sponsored by:	DARPA, AFRL
This commit is contained in:
Ruslan Bukin 2016-11-22 18:31:43 +00:00
parent bba39b9ae3
commit dd7d4f199e

View File

@ -2455,12 +2455,8 @@ sooptcopyin(struct sockopt *sopt, void *buf, size_t len, size_t minlen)
*/ */
if ((valsize = sopt->sopt_valsize) < minlen) if ((valsize = sopt->sopt_valsize) < minlen)
return EINVAL; 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; sopt->sopt_valsize = valsize = len;
}
if (sopt->sopt_td != NULL) if (sopt->sopt_td != NULL)
return (copyin(sopt->sopt_val, buf, valsize)); return (copyin(sopt->sopt_val, buf, valsize));