From b6312ad1857ba6260c52204d5452bfbf1a611757 Mon Sep 17 00:00:00 2001 From: paco Date: Wed, 27 Jun 2018 12:43:43 +0200 Subject: [PATCH] lib zebra: str-z check (2) (Coverity 1465494) 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 --- zebra/zebra_netns_notify.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c index a391f8343f..d0ea661403 100644 --- a/zebra/zebra_netns_notify.c +++ b/zebra/zebra_netns_notify.c @@ -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; -- 2.39.5