Avoid unwanted sign extension of indexed byte load in bpf code.
PR: 89748 Submitted by: Guy Harris <guy@alum.mit.edu> Obtained from: NetBSD via OpenBSD MFC after: 2 weeks
This commit is contained in:
parent
8f716f89cf
commit
a58327bd09
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159018
@ -334,7 +334,7 @@ bpf_filter(pc, p, wirelen, buflen)
|
||||
return 0;
|
||||
m = (struct mbuf *)p;
|
||||
MINDEX(m, k);
|
||||
A = mtod(m, char *)[k];
|
||||
A = mtod(m, u_char *)[k];
|
||||
continue;
|
||||
#else
|
||||
return 0;
|
||||
@ -353,7 +353,7 @@ bpf_filter(pc, p, wirelen, buflen)
|
||||
return 0;
|
||||
m = (struct mbuf *)p;
|
||||
MINDEX(m, k);
|
||||
X = (mtod(m, char *)[k] & 0xf) << 2;
|
||||
X = (mtod(m, u_char *)[k] & 0xf) << 2;
|
||||
continue;
|
||||
#else
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user