(tputs): Don't let ospeed overrun the speeds array.
This commit is contained in:
parent
6e2f2e9215
commit
c7c5360fe5
1 changed files with 3 additions and 1 deletions
|
@ -300,8 +300,10 @@ tputs (str, nlines, outfun)
|
|||
#else
|
||||
if (ospeed == 0)
|
||||
speed = tputs_baud_rate;
|
||||
else
|
||||
else if (ospeed > 0 && ospeed < (sizeof speeds / sizeof speeds[0]))
|
||||
speed = speeds[ospeed];
|
||||
else
|
||||
speed = 0;
|
||||
#endif
|
||||
|
||||
if (!str)
|
||||
|
|
Loading…
Add table
Reference in a new issue