summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormycroft <mycroft@NetBSD.org>1993-04-20 22:05:34 +0000
committermycroft <mycroft@NetBSD.org>1993-04-20 22:05:34 +0000
commit17218cf9a277aadf6eafecb1f87796581bfefc3b (patch)
treea43e8ac39f3485f2993fed84de53aef2edd648aa
parent10e9633963797cac6bb94bb2950e7a1fcc25c1d3 (diff)
downloadbsdgames-darwin-17218cf9a277aadf6eafecb1f87796581bfefc3b.tar.gz
bsdgames-darwin-17218cf9a277aadf6eafecb1f87796581bfefc3b.zip
Don't dereference NULL pointer.
-rw-r--r--snake/snake/move.c5
1 files changed, 4 insertions, 1 deletions
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