changeset 13677:ad4eada50462

(tputs): Don't let ospeed overrun the speeds array.
author David J. MacKenzie <djm@gnu.org>
date Thu, 30 Nov 1995 20:05:01 +0000
parents cace0c4acd88
children 7d9570072e6c
files src/termcap.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/termcap.c	Thu Nov 30 03:43:50 1995 +0000
+++ b/src/termcap.c	Thu Nov 30 20:05:01 1995 +0000
@@ -300,8 +300,10 @@
 #else
   if (ospeed == 0)
     speed = tputs_baud_rate;
+  else if (ospeed > 0 && ospeed < (sizeof speeds / sizeof speeds[0]))
+    speed = speeds[ospeed];
   else
-    speed = speeds[ospeed];
+    speed = 0;
 #endif
 
   if (!str)