Fix out-of-range memory access

(upstream git commit 757f78035da77fb84ad4ab479506f494353029d1)
This commit is contained in:
dcoppa 2011-11-07 09:49:45 +00:00
parent fbd0150eb5
commit 392c4fa859
2 changed files with 18 additions and 2 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.58 2011/11/07 09:17:07 dcoppa Exp $
# $OpenBSD: Makefile,v 1.59 2011/11/07 09:49:45 dcoppa Exp $
COMMENT= window manager based on the original Blackbox code
DISTNAME= fluxbox-1.3.2
REVISION= 0
REVISION= 1
CATEGORIES= x11

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-src_FbTk_StringUtil_cc,v 1.1 2011/11/07 09:49:45 dcoppa Exp $
Fix out-of-range memory access
(upstream git commit 757f78035da77fb84ad4ab479506f494353029d1)
--- src/FbTk/StringUtil.cc.orig Mon Nov 7 10:42:16 2011
+++ src/FbTk/StringUtil.cc Mon Nov 7 10:43:15 2011
@@ -176,7 +176,7 @@ string expandFilename(const string &filename) {
size_t pos = filename.find_first_not_of(" \t");
if (pos != string::npos && filename[pos] == '~') {
retval = getenv("HOME");
- if (pos != filename.size()) {
+ if (pos + 1 < filename.size()) {
// copy from the character after '~'
retval += static_cast<const char *>(filename.c_str() + pos + 1);
}