summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid J. MacKenzie <djm@gnu.org>1995-11-30 20:05:01 +0000
committerDavid J. MacKenzie <djm@gnu.org>1995-11-30 20:05:01 +0000
commitfc0a4f41db976adc84ffe4b61ae5547d6899267c (patch)
treee7be2b477a53febe7217082ab93dc851db774286
parent0640db58fc62642f219dd6264ac35f1b09d0b0e0 (diff)
downloademacs-fc0a4f41db976adc84ffe4b61ae5547d6899267c.tar.gz
(tputs): Don't let ospeed overrun the speeds array.
-rw-r--r--src/termcap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/termcap.c b/src/termcap.c
index 595fc425c18..26a12290778 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -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)