|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [qemu-xen stable-4.3] net: cadence_gem: check packet size in gem_recieve
commit e0f5252ed1ba0e1634e282a953a456da1ae637d6
Author: Prasad J Pandit <pjp@xxxxxxxxxxxxxxxxx>
AuthorDate: Fri Jan 15 12:30:40 2016 +0530
Commit: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
CommitDate: Fri Feb 5 14:47:09 2016 +0000
net: cadence_gem: check packet size in gem_recieve
While receiving packets in 'gem_receive' routine, if Frame Check
Sequence(FCS) is enabled, it copies the packet into a local
buffer without checking its size. Add check to validate packet
length against the buffer size to avoid buffer overflow.
Reported-by: Ling Liu <liuling-it@xxxxxx>
Signed-off-by: Prasad J Pandit <pjp@xxxxxxxxxxxxxxxxx>
Signed-off-by: Jason Wang <jasowang@xxxxxxxxxx>
---
hw/cadence_gem.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/cadence_gem.c b/hw/cadence_gem.c
index 0c037a2..8cd216c 100644
--- a/hw/cadence_gem.c
+++ b/hw/cadence_gem.c
@@ -659,6 +659,10 @@ static ssize_t gem_receive(NetClientState *nc, const
uint8_t *buf, size_t size)
unsigned crc_val;
int crc_offset;
+ if (size > sizeof(rxbuf) - sizeof(crc_val)) {
+ size = sizeof(rxbuf) - sizeof(crc_val);
+ }
+ bytes_to_copy = size;
/* The application wants the FCS field, which QEMU does not provide.
* We must try and caclculate one.
*/
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.3
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |