netem: fix out of bounds access in maketable
The maketable program used to generate one of the configuration files at build time for netem would access past the end of the array for one input value. This is a bug inherited from original NISTnet. Just fold the value, like other code there. This is not a runtime error security problem. It only impacts the build process if the build machine had extra hardening enabled. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
5551ed44d3
commit
2d3af1675d
|
|
@ -149,6 +149,8 @@ inverttable(int *table, int inversesize, int tablesize, int cumulative)
|
|||
inversevalue = (int)rint(findex*TABLEFACTOR);
|
||||
if (inversevalue <= MINSHORT) inversevalue = MINSHORT+1;
|
||||
if (inversevalue > MAXSHORT) inversevalue = MAXSHORT;
|
||||
if (inverseindex >= inversesize) inverseindex = inversesize- 1;
|
||||
|
||||
inverse[inverseindex] = inversevalue;
|
||||
}
|
||||
return inverse;
|
||||
|
|
|
|||
Loading…
Reference in New Issue