prevent an out of bounds access when pasting text.

problem hunted down and fix suggested by Deanna Phillips, thanks!
This commit is contained in:
steven 2006-11-17 23:31:45 +00:00
parent 4d5b5bca77
commit b9001d03e7
2 changed files with 14 additions and 2 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.3 2006/10/30 09:57:20 steven Exp $
# $OpenBSD: Makefile,v 1.4 2006/11/17 23:31:45 steven Exp $
COMMENT= "environment for rapid engineering and scientific processing"
VERSION= 2.0
DISTNAME= FreeMat-${VERSION}
PKGNAME= freemat-${VERSION}p0
PKGNAME= freemat-${VERSION}p1
CATEGORIES= math

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-libs_libXP_KeyManager_cpp,v 1.1 2006/11/17 23:31:45 steven Exp $
--- libs/libXP/KeyManager.cpp.orig Sat Nov 18 00:12:35 2006
+++ libs/libXP/KeyManager.cpp Sat Nov 18 00:13:14 2006
@@ -136,7 +136,7 @@ int KeyManager::DisplayedStringWidth(std
void KeyManager::InsertString(int pos, std::string s) {
int len = s.size();
- for (int i=4096-len;i>pos;i--)
+ for (int i=4096-len;i>pos && i>=len;i--)
lineData[i] = lineData[i-len];
const char* sptr = s.c_str();
for (int i=0;i<len;i++)