]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #2534 from pacovn/Coverity_1470113_Untrusted_array_index_write
authorRuss White <russ@riw.us>
Tue, 26 Jun 2018 15:18:38 +0000 (11:18 -0400)
committerGitHub <noreply@github.com>
Tue, 26 Jun 2018 15:18:38 +0000 (11:18 -0400)
zebra: untrusted array index (2) (Coverity 1470113)

zebra/zebra_netns_notify.c

index 5feb87b59dce8f4389cbdf49c82a42ea71ff84b0..a391f8343fcb553ea3593dacf6fd498dd990ba82 100644 (file)
@@ -212,7 +212,9 @@ static int zebra_ns_notify_read(struct thread *t)
                        continue;
                if (event->mask & IN_DELETE)
                        return zebra_ns_delete(event->name);
-               if (&event->name[event->len] >= &buf[sizeof(buf)]) {
+
+               if (offsetof(struct inotify_event, name) + event->len
+                   >= sizeof(buf)) {
                        zlog_err("NS notify read: buffer underflow");
                        break;
                }