Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vnc: avoid underflow when accessing user-provided address
If hostlen is zero, there is a possibility that addrstr[hostlen - 1] underflows and, if a closing bracked is there, hostlen - 2 is passed to g_strndup() on the next line. If websocket==false then addrstr[0] would be a colon, but if websocket==true this could in principle happen. Fix it by checking hostlen. Reported by Coverity. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 3f9c41c) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
- Loading branch information