diff options
author | deraadt <> | 2007-09-02 15:19:18 +0000 |
---|---|---|
committer | deraadt <> | 2007-09-02 15:19:18 +0000 |
commit | 4dce4206f0cafd0811f23aedc04a436aa9d145c1 (patch) | |
tree | 9bdb3d7b5724b183b1a397bf8f071fac1f056834 /src/lib/libc/net/getprotoent.c | |
parent | 7c27b50830c6058e8a7d8f2a3398c9c2f429b9f4 (diff) | |
download | openbsd-4dce4206f0cafd0811f23aedc04a436aa9d145c1.tar.gz openbsd-4dce4206f0cafd0811f23aedc04a436aa9d145c1.tar.bz2 openbsd-4dce4206f0cafd0811f23aedc04a436aa9d145c1.zip |
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'src/lib/libc/net/getprotoent.c')
-rw-r--r-- | src/lib/libc/net/getprotoent.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libc/net/getprotoent.c b/src/lib/libc/net/getprotoent.c index 7c6ab68166..f0705e0765 100644 --- a/src/lib/libc/net/getprotoent.c +++ b/src/lib/libc/net/getprotoent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: getprotoent.c,v 1.9 2006/01/17 15:41:52 millert Exp $ */ | 1 | /* $OpenBSD: getprotoent.c,v 1.10 2007/09/02 15:19:17 deraadt Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1983, 1993 | 3 | * Copyright (c) 1983, 1993 |
4 | * The Regents of the University of California. All rights reserved. | 4 | * The Regents of the University of California. All rights reserved. |
@@ -102,7 +102,7 @@ again: | |||
102 | pe->p_proto = l; | 102 | pe->p_proto = l; |
103 | if (pd->aliases == NULL) { | 103 | if (pd->aliases == NULL) { |
104 | pd->maxaliases = 5; | 104 | pd->maxaliases = 5; |
105 | pd->aliases = malloc(pd->maxaliases * sizeof(char *)); | 105 | pd->aliases = calloc(pd->maxaliases, sizeof(char *)); |
106 | if (pd->aliases == NULL) { | 106 | if (pd->aliases == NULL) { |
107 | serrno = errno; | 107 | serrno = errno; |
108 | endprotoent_r(pd); | 108 | endprotoent_r(pd); |