From c7c5360fe5501317ce839f04a57fc1b14184191a Mon Sep 17 00:00:00 2001 From: "David J. MacKenzie" Date: Thu, 30 Nov 1995 20:05:01 +0000 Subject: [PATCH] (tputs): Don't let ospeed overrun the speeds array. --- src/termcap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) -- 2.39.2