diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-03-27 13:03:55 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-03-27 13:03:55 +0000 |
commit | 71708e34a2da9bce144c5a7858ed9b686e33c22d (patch) | |
tree | 36b7305316bb44c96f1ff911c79ce86a97b9cb14 /usr.bin/ssh/dh.c | |
parent | 2bda64659c66d35f9ce7eb7e254b93fb0d9d6aab (diff) |
use strtonum() instead of atoi(), limit dhg size to 64k; ok djm
Diffstat (limited to 'usr.bin/ssh/dh.c')
-rw-r--r-- | usr.bin/ssh/dh.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/ssh/dh.c b/usr.bin/ssh/dh.c index 4db3b0b2a3a..b32a7efb556 100644 --- a/usr.bin/ssh/dh.c +++ b/usr.bin/ssh/dh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh.c,v 1.34 2006/03/25 13:17:01 djm Exp $ */ +/* $OpenBSD: dh.c,v 1.35 2006/03/27 13:03:54 deraadt Exp $ */ /* * Copyright (c) 2000 Niels Provos. All rights reserved. * @@ -44,6 +44,7 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg) { char *cp, *arg; char *strsize, *gen, *prime; + const char *errstr = NULL; cp = line; if ((arg = strdelim(&cp)) == NULL) @@ -68,7 +69,8 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg) goto fail; strsize = strsep(&cp, " "); /* size */ if (cp == NULL || *strsize == '\0' || - (dhg->size = atoi(strsize)) == 0) + (dhg->size = (u_int)strtonum(strsize, 0, 64*1024, &errstr)) == 0 || + errstr) goto fail; /* The whole group is one bit larger */ dhg->size++; |