diff options
Diffstat (limited to 'pasta.c')
| -rw-r--r-- | pasta.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -537,10 +537,13 @@ void pasta_netns_quit_inotify_handler(const struct ctx *c, int inotify_fd) if ((n = read(inotify_fd, buf, sizeof(buf))) < (ssize_t)sizeof(*ev)) return; + /* cppcheck-suppress [negativeIndex, unmatchedSuppression] */ + buf[n - 1] = '\0'; for (p = buf; p < buf + n; p += sizeof(*ev) + ev->len) { ev = (const struct inotify_event *)p; - if (!strncmp(ev->name, c->netns_base, sizeof(c->netns_base))) { + if (ev->len && + !strncmp(ev->name, c->netns_base, sizeof(c->netns_base))) { info("Namespace %s is gone, exiting", c->netns_base); passt_exit(EXIT_SUCCESS); } |
