diff options
| author | doug <> | 2014-10-11 04:22:03 +0000 |
|---|---|---|
| committer | doug <> | 2014-10-11 04:22:03 +0000 |
| commit | 5fbd4591c92d8f30811296027366fd1c53afcd32 (patch) | |
| tree | f01a5524428893c4e2bb4585d0bfbc1539ef9a12 /src | |
| parent | 778470f542afe0981d0f1f750e7ab530a7723a0d (diff) | |
| download | openbsd-5fbd4591c92d8f30811296027366fd1c53afcd32.tar.gz openbsd-5fbd4591c92d8f30811296027366fd1c53afcd32.tar.bz2 openbsd-5fbd4591c92d8f30811296027366fd1c53afcd32.zip | |
Userland reallocarray() audit.
Avoid potential integer overflow in the size argument of malloc() and
realloc() by using reallocarray() to avoid unchecked multiplication.
ok deraadt@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libc/net/getservent.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libc/net/getservent.c b/src/lib/libc/net/getservent.c index 7e3293389d..dc43da0a8b 100644 --- a/src/lib/libc/net/getservent.c +++ b/src/lib/libc/net/getservent.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: getservent.c,v 1.13 2014/09/15 06:15:48 guenther Exp $ */ | 1 | /* $OpenBSD: getservent.c,v 1.14 2014/10/11 04:22:03 doug 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. |
| @@ -122,8 +122,8 @@ again: | |||
| 122 | continue; | 122 | continue; |
| 123 | } | 123 | } |
| 124 | if (q == &se->s_aliases[sd->maxaliases - 1]) { | 124 | if (q == &se->s_aliases[sd->maxaliases - 1]) { |
| 125 | p = realloc(se->s_aliases, | 125 | p = reallocarray(se->s_aliases, sd->maxaliases, |
| 126 | 2 * sd->maxaliases * sizeof(char *)); | 126 | 2 * sizeof(char *)); |
| 127 | if (p == NULL) { | 127 | if (p == NULL) { |
| 128 | serrno = errno; | 128 | serrno = errno; |
| 129 | endservent_r(sd); | 129 | endservent_r(sd); |
