diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2007-08-08 21:24:30 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2007-08-08 21:24:30 +0000 |
commit | 80caedb98d88aa8dadbe239dfbc83e151eeba5e5 (patch) | |
tree | 7308458c9a7aa7bc18ad741369194bedb2003875 | |
parent | 40042dabacaef031f4d2c12985674b4a7b167c28 (diff) |
Clarify the example about avoiding overflow. OK ray@ deraadt@
-rw-r--r-- | lib/libc/stdlib/malloc.3 | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/stdlib/malloc.3 b/lib/libc/stdlib/malloc.3 index 58afb65c5c3..35f83a0c24c 100644 --- a/lib/libc/stdlib/malloc.3 +++ b/lib/libc/stdlib/malloc.3 @@ -30,9 +30,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $OpenBSD: malloc.3,v 1.46 2007/05/31 19:19:31 jmc Exp $ +.\" $OpenBSD: malloc.3,v 1.47 2007/08/08 21:24:29 millert Exp $ .\" -.Dd $Mdocdate: May 31 2007 $ +.Dd $Mdocdate: August 8 2007 $ .Dt MALLOC 3 .Os .Sh NAME @@ -100,7 +100,7 @@ If .Fn malloc must be used, be sure to test for overflow: .Bd -literal -offset indent -if (num && SIZE_MAX / num < size) { +if (size && num > SIZE_MAX / size) { errno = ENOMEM; err(1, "overflow"); } |