summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES3
-rw-r--r--src/Fl_Input_.cxx13
-rw-r--r--src/fl_shortcut.cxx6
3 files changed, 17 insertions, 5 deletions
diff --git a/CHANGES b/CHANGES
index c872c8086..9d6505aff 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,9 @@ CHANGES IN FLTK 1.1.5rc3
- Documentation updates (STR #505, STR #513)
- Updated PNG library source to 1.2.6 + wutil patch.
- Updated ZLIB library source to 1.2.1.
+ - Fixed an edge case in fl_old_shortcut() that could
+ cause it to read beyond then end of the shortcut
+ string (used for XForms named shortcuts)
- Added (unsupported) CMake files (STR #499)
- Tooltips would not reappear on the same widget, and
the initial tooltip delay was not used after a tooltip
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx
index 79dd91b30..6f42e6e8a 100644
--- a/src/Fl_Input_.cxx
+++ b/src/Fl_Input_.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.31 2004/09/09 21:34:46 matthiaswm Exp $"
+// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.32 2004/09/21 13:35:39 easysw Exp $"
//
// Common input widget routines for the Fast Light Tool Kit (FLTK).
//
@@ -793,6 +793,15 @@ void Fl_Input_::put_in_buffer(int len) {
} else {
bufsize = len+1;
}
+ // Note: the following code is equivalent to:
+ //
+ // if (moveit) value_ = value_ - buffer;
+ // char* nbuffer = (char*)realloc(buffer, bufsize);
+ // if (moveit) value_ = value_ + nbuffer;
+ // buffer = nbuffer;
+ //
+ // We just optimized the pointer arithmetic for value_...
+ //
char* nbuffer = (char*)realloc(buffer, bufsize);
if (moveit) value_ += (nbuffer-buffer);
buffer = nbuffer;
@@ -857,5 +866,5 @@ Fl_Input_::~Fl_Input_() {
}
//
-// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.31 2004/09/09 21:34:46 matthiaswm Exp $".
+// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.32 2004/09/21 13:35:39 easysw Exp $".
//
diff --git a/src/fl_shortcut.cxx b/src/fl_shortcut.cxx
index e945f6f24..161c978fd 100644
--- a/src/fl_shortcut.cxx
+++ b/src/fl_shortcut.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_shortcut.cxx,v 1.4.2.9.2.13 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: fl_shortcut.cxx,v 1.4.2.9.2.14 2004/09/21 13:35:40 easysw Exp $"
//
// Shortcut support routines for the Fast Light Tool Kit (FLTK).
//
@@ -176,7 +176,7 @@ int fl_old_shortcut(const char* s) {
if (*s == '#') {n |= FL_ALT; s++;}
if (*s == '+') {n |= FL_SHIFT; s++;}
if (*s == '^') {n |= FL_CTRL; s++;}
- if (s[1]) return n | (int)strtol(s,0,0); // allow 0xf00 to get any key
+ if (*s && s[1]) return n | (int)strtol(s,0,0); // allow 0xf00 to get any key
return n | *s;
}
@@ -201,5 +201,5 @@ int Fl_Widget::test_shortcut() {
}
//
-// End of "$Id: fl_shortcut.cxx,v 1.4.2.9.2.13 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: fl_shortcut.cxx,v 1.4.2.9.2.14 2004/09/21 13:35:40 easysw Exp $".
//