summaryrefslogtreecommitdiff
path: root/src/termcap.c
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
commitc7c5360fe5501317ce839f04a57fc1b14184191a (patch)
tree4833cf15458b5cf51c76aa63a0815d3906299b03 /src/termcap.c
parent6e2f2e921543daf459d633781c6b067738d4e458 (diff)
downloademacs-c7c5360fe5501317ce839f04a57fc1b14184191a.tar.gz
(tputs): Don't let ospeed overrun the speeds array.
Diffstat (limited to 'src/termcap.c')
-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)