qulogic/libgnt

81bc3498a388
Parents 5bb1c3496078
Children 14dbc1ec4834
Fix a couple of invalid reads after clearing the text in an entry box.
  • +5 -2
    gntentry.c
  • --- a/gntentry.c Thu Oct 08 18:03:05 2009 +0000
    +++ b/gntentry.c Tue Oct 27 23:35:45 2009 +0000
    @@ -1044,8 +1044,11 @@
    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));