Skip to content

Commit

Permalink
waveshare-raw: avoid possible overflow by casting a multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
merge committed Sep 19, 2018
1 parent cd77bef commit a5b39bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/waveshare-raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
/*
Expand Down Expand Up @@ -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) {
/*
Expand Down

0 comments on commit a5b39bf

Please sign in to comment.