From 17218cf9a277aadf6eafecb1f87796581bfefc3b Mon Sep 17 00:00:00 2001 From: mycroft Date: Tue, 20 Apr 1993 22:05:34 +0000 Subject: Don't dereference NULL pointer. --- snake/snake/move.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'snake') diff --git a/snake/snake/move.c b/snake/snake/move.c index cbfeaa3c..df985831 100644 --- a/snake/snake/move.c +++ b/snake/snake/move.c @@ -601,7 +601,10 @@ getcap() KR = tgetstr("kr", &ap); KU = tgetstr("ku", &ap); KD = tgetstr("kd", &ap); - Klength = strlen(KL); + if (KL && KR && KU && KD) + Klength = strlen(KL); + else + Klength = 0; /* NOTE: If KL, KR, KU, and KD are not * all the same length, some problems * may arise, since tests are made on -- cgit v1.2.3