slirp: Add sanity check for str option length
When user provides a long domainname or hostname that doesn't fit in the DHCP packet, we mustn't overflow the response packet buffer. Instead, report errors, following the g_warning() in the slirp->vdnssearch branch. Also check the strlen against 256 when initializing slirp, which limit is also from the protocol where one byte represents the string length. This gives an early error before the warning which is harder to notice or diagnose. Reported-by: NThomas Huth <thuth@redhat.com> Reviewed-by: NThomas Huth <thuth@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: NFam Zheng <famz@redhat.com> Tested-by: NGerd Hoffmann <kraxel@redhat.com> Signed-off-by: NSamuel Thibault <samuel.thibault@ens-lyon.org> (cherry picked from commit 6e157a03) Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
Showing
想要评论请 注册 或 登录