diff options
author | Ben Pfaff <blp@nicira.com> | 2013-01-23 15:12:10 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-01-23 15:12:10 -0800 |
commit | 4a1d4e86fcf221cdbab551198255b0fcfc91295a (patch) | |
tree | 6c4b375badd66c89f5c4c83b130282e79976e3d3 /vswitchd/bridge.c | |
parent | 4c1b1289733b62316f8f1ad25bfc1f9d3e617dee (diff) | |
download | openvswitch-4a1d4e86fcf221cdbab551198255b0fcfc91295a.tar.gz |
bridge: Fix bug in equal_pathnames().
Reported-by: Pavithra Ramesh <paramesh@vmware.com>
Acked-by: Pavithra Ramesh <paramesh@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'vswitchd/bridge.c')
-rw-r--r-- | vswitchd/bridge.c | 9 |
1 files changed, 6 insertions, 3 deletions
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 |