diff options
author | Damien Miller <djm@mindrot.org> | 2006-03-31 23:09:41 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2006-03-31 23:09:41 +1100 |
commit | 5a73c1a34d7ed75295da703c835464746474d297 (patch) | |
tree | 8245892a38475070feb4880f1d87d661ffb9ee7c | |
parent | da380becc6d9cc00c7e4c892354d93cd1fc12431 (diff) |
- deraadt@cvs.openbsd.org 2006/03/27 13:03:54
[dh.c]
use strtonum() instead of atoi(), limit dhg size to 64k; ok djm
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | dh.c | 6 |
2 files changed, 8 insertions, 3 deletions
@@ -4,6 +4,9 @@ | |||
4 | [xmalloc.c] | 4 | [xmalloc.c] |
5 | we can do the size & nmemb check before the integer overflow check; | 5 | we can do the size & nmemb check before the integer overflow check; |
6 | evol | 6 | evol |
7 | - deraadt@cvs.openbsd.org 2006/03/27 13:03:54 | ||
8 | [dh.c] | ||
9 | use strtonum() instead of atoi(), limit dhg size to 64k; ok djm | ||
7 | 10 | ||
8 | 20060326 | 11 | 20060326 |
9 | - OpenBSD CVS Sync | 12 | - OpenBSD CVS Sync |
@@ -4453,4 +4456,4 @@ | |||
4453 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM | 4456 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM |
4454 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu | 4457 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu |
4455 | 4458 | ||
4456 | $Id: ChangeLog,v 1.4288 2006/03/31 12:09:17 djm Exp $ | 4459 | $Id: ChangeLog,v 1.4289 2006/03/31 12:09:41 djm Exp $ |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dh.c,v 1.34 2006/03/25 13:17:01 djm Exp $ */ | 1 | /* $OpenBSD: dh.c,v 1.35 2006/03/27 13:03:54 deraadt Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Niels Provos. All rights reserved. | 3 | * Copyright (c) 2000 Niels Provos. All rights reserved. |
4 | * | 4 | * |
@@ -44,6 +44,7 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg) | |||
44 | { | 44 | { |
45 | char *cp, *arg; | 45 | char *cp, *arg; |
46 | char *strsize, *gen, *prime; | 46 | char *strsize, *gen, *prime; |
47 | const char *errstr = NULL; | ||
47 | 48 | ||
48 | cp = line; | 49 | cp = line; |
49 | if ((arg = strdelim(&cp)) == NULL) | 50 | if ((arg = strdelim(&cp)) == NULL) |
@@ -68,7 +69,8 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg) | |||
68 | goto fail; | 69 | goto fail; |
69 | strsize = strsep(&cp, " "); /* size */ | 70 | strsize = strsep(&cp, " "); /* size */ |
70 | if (cp == NULL || *strsize == '\0' || | 71 | if (cp == NULL || *strsize == '\0' || |
71 | (dhg->size = atoi(strsize)) == 0) | 72 | (dhg->size = (u_int)strtonum(strsize, 0, 64*1024, &errstr)) == 0 || |
73 | errstr) | ||
72 | goto fail; | 74 | goto fail; |
73 | /* The whole group is one bit larger */ | 75 | /* The whole group is one bit larger */ |
74 | dhg->size++; | 76 | dhg->size++; |