chiark / gitweb /
integer and buffer overflows: introduce safe_malloc_ary
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 12 Jun 2011 21:28:33 +0000 (22:28 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Jun 2011 11:07:25 +0000 (12:07 +0100)
commitbb9d056157e37451ec14800d5914733a625f1901
tree712a9d1c88d8afd0e0ae63f1953d64bfd8bac1ab
parent59230b9b9fc44453f24c6b3cf33a0f4c570a3563
integer and buffer overflows: introduce safe_malloc_ary

When allocating an array, it is necessary to check that the
multiplication (to compute the size in bytes) does not overflow.

Do this in a new function safe_malloc_ary, which we call in both the
places where safe_malloc was previously used with an unchecked
multiplication.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
ipaddr.c
netlink.c
secnet.h
util.c