Changeset 45e2c95 for keymap.c


Ignore:
Timestamp:
Mar 24, 2011, 4:09:22 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
d07af84
Parents:
b13daa0
git-author:
David Benjamin <davidben@mit.edu> (03/10/11 15:45:00)
git-committer:
David Benjamin <davidben@mit.edu> (03/24/11 16:09:22)
Message:
Don't pass limited buffer lengths to owl_keybinding_tostring

The keymap tostring code still probably should be cleaned up though.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • keymap.c

    rb13daa0 r45e2c95  
    144144  nbindings = owl_list_get_size(&km->bindings);
    145145  for (i=0; i<nbindings; i++) {
    146     char buff[100];
     146    char *kbstr;
    147147    const owl_cmd *cmd;
    148148    const char *tmpdesc, *desc = "";
    149149
    150150    kb = owl_list_get_element(&km->bindings, i);
    151     owl_keybinding_tostring(kb, buff, 100);
     151    kbstr = owl_keybinding_tostring(kb);
    152152    owl_fmtext_append_normal(fm, OWL_TABSTR);
    153     owl_fmtext_append_normal(fm, buff);
    154     owl_fmtext_append_spaces(fm, 11-strlen(buff));
     153    owl_fmtext_append_normal(fm, kbstr);
     154    owl_fmtext_append_spaces(fm, 11-strlen(kbstr));
     155    g_free(kbstr);
    155156    owl_fmtext_append_normal(fm, " - ");
    156157    if (kb->desc && *kb->desc) {
     
    313314void owl_keyhandler_invalidkey(owl_keyhandler *kh)
    314315{
    315     char kbbuff[500];
    316     owl_keybinding_stack_tostring(kh->kpstack, kh->kpstackpos+1, kbbuff, 500);
     316    char *kbbuff = owl_keybinding_stack_tostring(kh->kpstack, kh->kpstackpos+1);
    317317    owl_function_makemsg("'%s' is not a valid key in this context.", kbbuff);
     318    g_free(kbbuff);
    318319    owl_keyhandler_reset(kh);
    319320}
Note: See TracChangeset for help on using the changeset viewer.