aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/comm
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2010-03-09 21:06:17 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2010-03-09 21:06:17 +0000
commit0100f0ddf795d8cd2f7d1bfe4e12ec44382c3053 (patch)
tree9e994e7e942ddf69371ac0b76679627284d0b27a /usr.bin/comm
parentd2796d06d3b1c21694a14cc40f03b41d4501a09c (diff)
downloadsrc-0100f0ddf795d8cd2f7d1bfe4e12ec44382c3053.tar.gz
src-0100f0ddf795d8cd2f7d1bfe4e12ec44382c3053.zip
Add SIZE_MAX overflow check
Notes
Notes: svn path=/head/; revision=204928
Diffstat (limited to 'usr.bin/comm')
-rw-r--r--usr.bin/comm/comm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/comm/comm.c b/usr.bin/comm/comm.c
index b9109112dccf..ddad5dc8fe8a 100644
--- a/usr.bin/comm/comm.c
+++ b/usr.bin/comm/comm.c
@@ -201,6 +201,8 @@ convert(const char *str)
if ((n = mbstowcs(NULL, str, 0)) == (size_t)-1)
return (NULL);
+ if (SIZE_MAX / sizeof(*buf) < n + 1)
+ errx(1, "conversion buffer length overflow");
if ((buf = malloc((n + 1) * sizeof(*buf))) == NULL)
err(1, "malloc");
if (mbstowcs(buf, str, n + 1) != n)