sde1000 / NanodeUIP

Port of uIP library to Nanode
http://wiki.hackspace.org.uk/wiki/Project:Nanode/UIP
38 stars 22 forks source link

[PATCH] Buffer overrun bug in enc28j60ReadBuffer #3

Closed maniacbug closed 12 years ago

maniacbug commented 12 years ago

From e7db1e7d356eaff1d6f8c53a6e017673bd55748c Mon Sep 17 00:00:00 2001
From: maniacbug 
Date: Sun, 1 Jan 2012 21:50:05 -0800
Subject: [PATCH] Fixed a buffer overrun bug in enc28j60ReadBuffer.  This
 writes all over memory it doesn't own.  Bad stuff.

---
 enc28j60.cpp |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/enc28j60.cpp b/enc28j60.cpp
index 3d5630e..ee04647 100644
--- a/enc28j60.cpp
+++ b/enc28j60.cpp
@@ -86,7 +86,6 @@ void enc28j60ReadBuffer(uint16_t len, uint8_t* data)
         *data++ = SPDR;
     }
     disableChip();
-    *data='\0';
 }

 static word enc28j60ReadBufferWord() {
-- 
1.7.5.4
sde1000 commented 12 years ago

Ouch, good catch. This is in the code that came from EtherShield. It looks like it's already been fixed there; I'll make the same change here.