virNetDevOpenvswitchGetVhostuserIfname: Fix off by one error

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>
This commit is contained in:
Michal Privoznik 2017-06-08 14:58:22 +02:00
parent 2a13a0a103
commit f3908d8557

View File

@ -444,6 +444,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path,
goto cleanup; goto cleanup;
} }
tmpIfname++;
cmd = virCommandNew(OVSVSCTL); cmd = virCommandNew(OVSVSCTL);
virNetDevOpenvswitchAddTimeout(cmd); virNetDevOpenvswitchAddTimeout(cmd);
virCommandAddArgList(cmd, "get", "Interface", tmpIfname, "name", NULL); virCommandAddArgList(cmd, "get", "Interface", tmpIfname, "name", NULL);