pidgin: 371c4bb9: Fix a couple of invalid reads after clea...
sadrul at pidgin.im
sadrul at pidgin.im
Tue Oct 27 20:35:38 EDT 2009
-----------------------------------------------------------------
Revision: 371c4bb92e5001e2cd97c9c26336cc9666e9bef3
Ancestor: 7b1d6e64a003d7c813ccd017489ecaed2b0e9201
Author: sadrul at pidgin.im
Date: 2009-10-27T23:35:45
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/371c4bb92e5001e2cd97c9c26336cc9666e9bef3
Modified files:
finch/libgnt/gntentry.c
ChangeLog:
Fix a couple of invalid reads after clearing the text in an entry box.
-------------- next part --------------
============================================================
--- finch/libgnt/gntentry.c 460cc9d3e71a622f63bb23b0cad0717d4cefa160
+++ finch/libgnt/gntentry.c 684dcf564690db94d19643dbc35bc2eb24bd139e
@@ -1044,9 +1044,12 @@ gnt_entry_set_text_internal(GntEntry *en
snprintf(entry->start, len + 1, "%s", text);
entry->end = entry->start + len;
- entry->scroll = entry->start + scroll;
- entry->cursor = entry->end - cursor;
+ if ((entry->scroll = entry->start + scroll) > entry->end)
+ entry->scroll = entry->end;
+ if ((entry->cursor = entry->end - cursor) > entry->end)
+ entry->cursor = entry->end;
+
if (GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(entry), GNT_WIDGET_MAPPED))
entry_redraw(GNT_WIDGET(entry));
}
More information about the Commits
mailing list