summary refs log tree commit diff stats
path: root/slirp/mbuf.h
diff options
context:
space:
mode:
authorPrasad J Pandit <pjp@fedoraproject.org>2018-06-05 23:38:35 +0530
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-06-08 09:08:30 +0300
commit864036e251f54c99d31df124aad7f34f01f5344c (patch)
treeca78196ce84b59fe837722729d93bc043d1192b0 /slirp/mbuf.h
parent3835c310bd13662d5fb3f50f3dd62605dfd40cf9 (diff)
downloadfocaccia-qemu-864036e251f54c99d31df124aad7f34f01f5344c.tar.gz
focaccia-qemu-864036e251f54c99d31df124aad7f34f01f5344c.zip
slirp: correct size computation while concatenating mbuf
While reassembling incoming fragmented datagrams, 'm_cat' routine
extends the 'mbuf' buffer, if it has insufficient room. It computes
a wrong buffer size, which leads to overwriting adjacent heap buffer
area. Correct this size computation in m_cat.

Reported-by: ZDI Disclosures <zdi-disclosures@trendmicro.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/mbuf.h')
-rw-r--r--slirp/mbuf.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/slirp/mbuf.h b/slirp/mbuf.h
index 893601ff9d..33b84485d6 100644
--- a/slirp/mbuf.h
+++ b/slirp/mbuf.h
@@ -33,8 +33,6 @@
 #ifndef MBUF_H
 #define MBUF_H
 
-#define MINCSIZE 4096	/* Amount to increase mbuf if too small */
-
 /*
  * Macros for type conversion
  * mtod(m,t) -	convert mbuf pointer to data pointer of correct type
@@ -72,11 +70,11 @@ struct mbuf {
 	struct	mbuf *m_prevpkt;	/* Flags aren't used in the output queue */
 	int	m_flags;		/* Misc flags */
 
-	int	m_size;			/* Size of data */
+	int	m_size;			/* Size of mbuf, from m_dat or m_ext */
 	struct	socket *m_so;
 
-	caddr_t	m_data;			/* Location of data */
-	int	m_len;			/* Amount of data in this mbuf */
+	caddr_t	m_data;			/* Current location of data */
+	int	m_len;			/* Amount of data in this mbuf, from m_data */
 
 	Slirp *slirp;
 	bool	resolution_requested;