util.c: add len sanity checks to dumpstr

Reported by clang.

* util.c (dumpstr): Check that len is sane.
This commit is contained in:
Eugene Syromyatnikov 2018-05-02 20:57:58 +02:00 committed by Dmitry V. Levin
parent ee023f97ab
commit 973687fd92

3
util.c
View File

@ -928,6 +928,9 @@ dumpstr(struct tcb *const tcp, const kernel_ulong_t addr, const int len)
const unsigned char *src;
int i;
if ((len < 0) || (len > INT_MAX - 16))
return;
memset(outbuf, ' ', sizeof(outbuf));
if (strsize < len + 16) {