[libvirt] [PATCH] virNetDevOpenvswitchGetVhostuserIfname: Fix off by one error

Michal Privoznik posted 1 patch 6 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/f3908d8557dc609e2262099d76c57b0bcc4b0917.1496926957.git.mprivozn@redhat.com
src/util/virnetdevopenvswitch.c | 1 +
1 file changed, 1 insertion(+)
[libvirt] [PATCH] virNetDevOpenvswitchGetVhostuserIfname: Fix off by one error
Posted by Michal Privoznik 6 years, 10 months ago
https://bugzilla.redhat.com/show_bug.cgi?id=1459091

We try to get the last element of the passed path by calling
strrch(path, '/'). However, the pointer that strrchr() returns
points at the slash, We want string that starts right after that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---

Pushed as trivial.

 src/util/virnetdevopenvswitch.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index 42abcb4bb..8f7215e06 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -444,6 +444,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path,
         goto cleanup;
     }
 
+    tmpIfname++;
     cmd = virCommandNew(OVSVSCTL);
     virNetDevOpenvswitchAddTimeout(cmd);
     virCommandAddArgList(cmd, "get", "Interface", tmpIfname, "name", NULL);
-- 
2.13.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list