[packages] wview: fix segmentation fault in WMR USB driver

Do not overflow the input buffer. This happens on slow hosts that take
long time to recompute the data on start.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>

git-svn-id: svn://svn.openwrt.org/openwrt/packages@36390 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jogo 2013-04-23 09:17:07 +00:00
parent 8d02f073ed
commit d142914b8f
2 changed files with 19 additions and 1 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=wview
PKG_VERSION:=5.19.0-jgoerzen
PKG_RELEASE=$(PKG_SOURCE_VERSION)-r1
PKG_RELEASE=$(PKG_SOURCE_VERSION)-r2
PKG_SOURCE_URL:=git://github.com/jgoerzen/wview.git
PKG_SOURCE_VERSION:=7bfac6c11e756290c38e7b5862a4c51b6bc6c51e
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)

View File

@ -0,0 +1,18 @@
Index: wview-5.19.0-jgoerzen/stations/WMRUSB/wmrusbprotocol.c
===================================================================
--- wview-5.19.0-jgoerzen.orig/stations/WMRUSB/wmrusbprotocol.c 2013-03-10 22:24:28.000000000 +0400
+++ wview-5.19.0-jgoerzen/stations/WMRUSB/wmrusbprotocol.c 2013-03-10 22:25:01.000000000 +0400
@@ -897,8 +897,11 @@
// Read raw USB data and buffer it for later processing:
void wmrReadData (WVIEWD_WORK *work, WMRUSB_MSG_DATA* msg)
{
- memcpy(&wmrWork.readData[wmrWork.readIndex], msg->data, msg->length);
- wmrWork.readIndex += msg->length;
+ if (wmrWork.readIndex + msg->length <= WMR_BUFFER_LENGTH)
+ {
+ memcpy(&wmrWork.readData[wmrWork.readIndex], msg->data, msg->length);
+ wmrWork.readIndex += msg->length;
+ }
return;
}