From a5b39bf2efe9c081423785b9ed4a40bf934f9070 Mon Sep 17 00:00:00 2001 From: Martin Kepplinger Date: Wed, 19 Sep 2018 13:54:42 +0200 Subject: [PATCH] waveshare-raw: avoid possible overflow by casting a multiplication --- plugins/waveshare-raw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/waveshare-raw.c b/plugins/waveshare-raw.c index 011a3583..9f74f67e 100644 --- a/plugins/waveshare-raw.c +++ b/plugins/waveshare-raw.c @@ -114,7 +114,7 @@ static int waveshare_read(struct tslib_module_info *inf, struct ts_sample *samp, buf = alloca(i->len * nr); - ret = read(ts->fd, buf, i->len * nr); + ret = read(ts->fd, buf, (size_t) i->len * nr); if (ret > 0) { while (ret >= (int) i->len) { /* @@ -234,7 +234,7 @@ static int waveshare_read_mt(struct tslib_module_info *inf, buf = alloca(i->len * nr); - ret = read(ts->fd, buf, i->len * nr); + ret = read(ts->fd, buf, (size_t) i->len * nr); if (ret > 0) { while (ret >= (int) i->len) { /*