summaryrefslogtreecommitdiff
path: root/usr.bin/uniq
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2010-03-09 21:06:01 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2010-03-09 21:06:01 +0000
commitd2796d06d3b1c21694a14cc40f03b41d4501a09c (patch)
tree82a86d65530c1fe80ce05a35cdd49037f4c39b61 /usr.bin/uniq
parenta6c03411f28808b989f16b12c7c2efac2c76928a (diff)
downloadsrc-test2-d2796d06d3b1c21694a14cc40f03b41d4501a09c.tar.gz
src-test2-d2796d06d3b1c21694a14cc40f03b41d4501a09c.zip
Notes
Diffstat (limited to 'usr.bin/uniq')
-rw-r--r--usr.bin/uniq/uniq.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/uniq/uniq.c b/usr.bin/uniq/uniq.c
index 5416b0b07f6c..605bd00580ac 100644
--- a/usr.bin/uniq/uniq.c
+++ b/usr.bin/uniq/uniq.c
@@ -196,6 +196,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)