28 lines
969 B
Plaintext
28 lines
969 B
Plaintext
$OpenBSD: patch-src_FbTk_StringUtil_cc,v 1.2 2011/12/29 16:15:53 dcoppa Exp $
|
|
|
|
Fix out-of-range memory access
|
|
(upstream git commit 757f78035da77fb84ad4ab479506f494353029d1)
|
|
|
|
Don't return mid-routine
|
|
(upstream git commit 65cb53b68551fde7dafe97f08c90b69f972f93ef)
|
|
|
|
--- src/FbTk/StringUtil.cc.orig Sat Oct 29 15:46:15 2011
|
|
+++ src/FbTk/StringUtil.cc Thu Dec 29 16:39:07 2011
|
|
@@ -176,12 +176,13 @@ 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);
|
|
}
|
|
- } else
|
|
- return filename; //return unmodified value
|
|
+ } else {
|
|
+ retval = filename; //return unmodified value
|
|
+ }
|
|
|
|
return retval;
|
|
}
|