summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2011-12-28 21:09:49 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2011-12-28 21:09:49 +0000
commit85f53545ad3b83738b02f92363a5938346b39bcb (patch)
treeda5910aa654ae33551566ddc1adf44f8a05b220a /usr.bin
parentd106457f651c5559c73850e6388875b34321b4bd (diff)
As pointed out by Dan Rosenberg our telnet client has the same
overflow when using encryption as the recent FreeBSD advisory. Use the same approach taken in FreeBSD to protect against malicious servers. ok miod@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/telnet/encrypt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/telnet/encrypt.c b/usr.bin/telnet/encrypt.c
index 4781e991b3d..006bd25cfe7 100644
--- a/usr.bin/telnet/encrypt.c
+++ b/usr.bin/telnet/encrypt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: encrypt.c,v 1.3 2006/12/21 02:44:55 krw Exp $ */
+/* $OpenBSD: encrypt.c,v 1.4 2011/12/28 21:09:48 jsg Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -739,6 +739,9 @@ encrypt_keyid(struct key_info *kp, unsigned char *keyid, int len)
int dir = kp->dir;
int ret = 0;
+ if (len > MAXKEYLEN)
+ len = MAXKEYLEN;
+
if (!(ep = (*kp->getcrypt)(*kp->modep))) {
if (len == 0)
return;