Fix possible out-of-bounds read in inotify_event parser

Found by Coverity Scan.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2021-03-07 09:57:07 +01:00
1 parent 790a316607
commit d6390244ad
1 file changed
+6
+6
View File
@@ -163,7 +163,13 @@ static void pidfile_callback(void *arg, int fd, int events)
for (off = 0; off < sz; off += sizeof(*ev) + ev->len) {
struct iwatch_path *iwp;
if (off + sizeof(*ev) >= sizeof(ev_buf))
break;
ev = (struct inotify_event *)&ev_buf[off];
if (off + sizeof(*ev) + ev->len >= sizeof(ev_buf))
break;
if (!ev->mask)
continue;