Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:Update
qemu-linux-user
0397-libslirp-Add-mtod_check.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0397-libslirp-Add-mtod_check.patch of Package qemu-linux-user
From: Jose R Ziviani <jose.ziviani@suse.com> Date: Tue, 6 Jul 2021 16:54:19 -0600 Subject: libslirp: Add mtod_check() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git-commit: 93e645e72a056ec0b2c16e0299fc5c6b94e4ca17 References: bsc#1187364, CVE-2021-3592 bsc#1187367, CVE-2021-3594 Recent security issues demonstrate the lack of safety care when casting a mbuf to a particular structure type. At least, it should check that the buffer is large enough. The following patches will make use of this function. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Jose R Ziviani <jose.ziviani@suse.com> --- slirp/mbuf.c | 11 +++++++++++ slirp/mbuf.h | 1 + 2 files changed, 12 insertions(+) diff --git a/slirp/mbuf.c b/slirp/mbuf.c index 65b26db5d874e1205ceda9bebc3c..72c2f3dc4f6059073b32315ca4d6 100644 --- a/slirp/mbuf.c +++ b/slirp/mbuf.c @@ -240,3 +240,14 @@ dtom(Slirp *slirp, void *dat) return (struct mbuf *)0; } + +void *mtod_check(struct mbuf *m, size_t len) +{ + if (m->m_len >= len) { + return m->m_data; + } + + DEBUG_ERROR("mtod failed"); + + return NULL; +} diff --git a/slirp/mbuf.h b/slirp/mbuf.h index 00a473b9d277b3f745fbd089b6b3..24eafdb30470efa6ed85ce90981e 100644 --- a/slirp/mbuf.h +++ b/slirp/mbuf.h @@ -105,6 +105,7 @@ void m_inc(struct mbuf *, int); void m_adj(struct mbuf *, int); int m_copy(struct mbuf *, struct mbuf *, int, int); struct mbuf * dtom(Slirp *, void *); +void *mtod_check(struct mbuf *, size_t len); static inline void ifs_init(struct mbuf *ifm) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor