diff --git a/plugins/pidfile.c b/plugins/pidfile.c index 20e11afc..3bd1a7a9 100644 --- a/plugins/pidfile.c +++ b/plugins/pidfile.c @@ -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;