diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2010-03-09 21:06:01 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2010-03-09 21:06:01 +0000 |
| commit | d2796d06d3b1c21694a14cc40f03b41d4501a09c (patch) | |
| tree | 82a86d65530c1fe80ce05a35cdd49037f4c39b61 | |
| parent | a6c03411f28808b989f16b12c7c2efac2c76928a (diff) | |
Notes
| -rw-r--r-- | usr.bin/uniq/uniq.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/uniq/uniq.c b/usr.bin/uniq/uniq.c index 5416b0b07f6c8..605bd00580acf 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) |
