]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib zebra: str-z check (2) (Coverity 1465494) 2563/head
authorpaco <paco@voltanet.io>
Wed, 27 Jun 2018 10:43:43 +0000 (12:43 +0200)
committerpaco <paco@voltanet.io>
Wed, 27 Jun 2018 12:22:01 +0000 (14:22 +0200)
This is an additional correction after  45981fda0634f7277c27c2a55e30d7f3433ffa16 / PR #2462. I hope
this fixes the Coverity warning (I've added an additional check for ensuring
the string provided by the inotify read is zero-terminated).

Signed-off-by: F. Aragon <paco@voltanet.io>
zebra/zebra_netns_notify.c

index a391f8343fcb553ea3593dacf6fd498dd990ba82..d0ea661403d0bdc0ffecce3289ec8a4d3ac540ae 100644 (file)
@@ -218,6 +218,12 @@ static int zebra_ns_notify_read(struct thread *t)
                        zlog_err("NS notify read: buffer underflow");
                        break;
                }
+
+               if (strnlen(event->name, event->len) == event->len) {
+                       zlog_err("NS notify error: bad event name");
+                       break;
+               }
+
                netnspath = ns_netns_pathname(NULL, event->name);
                if (!netnspath)
                        continue;