diff options
| author | Laurent Vivier <lvivier@redhat.com> | 2026-10-15 12:07:41 +0200 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2026-10-25 14:04:34 +0100 |
| commit | 6aa4f88bd9846411edff3ed70460475b538addca (patch) | |
| tree | 5616207d8e8867f357eaf80682c6a8e980123fad | |
| parent | ad43e4539ab0eb3d40619f4b426ac1e1bd36b1d3 (diff) | |
| download | passt-master.tar passt-master.tar.gz passt-master.tar.bz2 passt-master.tar.lz passt-master.tar.xz passt-master.tar.zst passt-master.zip | |
By the time we reach buf[n - 1] = '\0', n < 0 and n < sizeof(*ev)
are already handled above, so the index is always positive. Add a
cppcheck-suppress annotation to silence the false positive.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
[sbrivio: Add unmatchedSuppression for compatibility]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
| -rw-r--r-- | passt-repair.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/passt-repair.c b/passt-repair.c index 80a3908..3958c3a 100644 --- a/passt-repair.c +++ b/passt-repair.c @@ -95,6 +95,7 @@ static int wait_for_socket(struct sockaddr_un *a, const char *dir, continue; } + /* 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; |
