From: Ben Pfaff Date: Wed, 23 Jan 2013 23:12:10 +0000 (-0800) Subject: bridge: Fix bug in equal_pathnames(). X-Git-Tag: sliver-openvswitch-1.9.90-3~8^2~1 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=4a1d4e86fcf221cdbab551198255b0fcfc91295a bridge: Fix bug in equal_pathnames(). Reported-by: Pavithra Ramesh Acked-by: Pavithra Ramesh Signed-off-by: Ben Pfaff --- diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 82c3bffc8..dd3099f84 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -2740,8 +2740,12 @@ static bool equal_pathnames(const char *a, const char *b, size_t b_stoplen) { const char *b_start = b; - while (b - b_start < b_stoplen && *a == *b) { - if (*a == '/') { + for (;;) { + if (b - b_start >= b_stoplen) { + return true; + } else if (*a != *b) { + return false; + } else if (*a == '/') { a += strspn(a, "/"); b += strspn(b, "/"); } else if (*a == '\0') { @@ -2751,7 +2755,6 @@ equal_pathnames(const char *a, const char *b, size_t b_stoplen) b++; } } - return false; } static void