]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: untrusted array index (2) (Coverity 1470113) 2534/head
authorpaco <paco@voltanet.io>
Fri, 22 Jun 2018 15:14:57 +0000 (17:14 +0200)
committerpaco <paco@voltanet.io>
Fri, 22 Jun 2018 19:10:50 +0000 (21:10 +0200)
This is a correction over 7f61ea7bd47bfd86a2c873870507281b1837dcdd in order
to avoid the TAINTED_SCALAR Coverity warning (ending in "Untrusted array
index read"). This is equivalent to the previous commit, but avoiding
pointer arithmetic with tainted variables.

Signed-off-by: F. Aragon <paco@voltanet.io>
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;
                }