Changeset 3773:f5d38bf9bfdd for buffy.c

Show
Ignore:
Timestamp:
2004-10-30 14:59:00 (4 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

safe_strcat, safe_strncat. Thanks to Ulf H. for noting the wrong
use of strncat in part of the mutt code base.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • buffy.c

    r3597 r3773  
    440440  first = 1; 
    441441  buffylist[0] = 0; 
    442   pos += strlen (strncat (buffylist, _("New mail in "), sizeof (buffylist) - 1 - pos)); 
     442  pos += strlen (strncat (buffylist, _("New mail in "), sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */ 
    443443  for (tmp = Incoming; tmp; tmp = tmp->next) 
    444444  { 
     
    454454     
    455455    if (!first) 
    456       pos += strlen (strncat(buffylist + pos, ", ", sizeof(buffylist)-1-pos)); 
     456      pos += strlen (strncat(buffylist + pos, ", ", sizeof(buffylist)-1-pos)); /* __STRNCAT_CHECKED__ */ 
    457457 
    458458    /* Prepend an asterisk to mailboxes not already notified */ 
    459459    if (!tmp->notified) 
    460460    { 
    461       /* pos += strlen (strncat(buffylist + pos, "*", sizeof(buffylist)-1-pos)); */ 
     461      /* pos += strlen (strncat(buffylist + pos, "*", sizeof(buffylist)-1-pos));  __STRNCAT_CHECKED__ */ 
    462462      tmp->notified = 1; 
    463463      BuffyNotify--; 
    464464    } 
    465     pos += strlen (strncat(buffylist + pos, path, sizeof(buffylist)-1-pos)); 
     465    pos += strlen (strncat(buffylist + pos, path, sizeof(buffylist)-1-pos)); /* __STRNCAT_CHECKED__ */ 
    466466    first = 0; 
    467467  } 
    468468  if (!first && tmp) 
    469469  { 
    470     strncat (buffylist + pos, ", ...", sizeof (buffylist) - 1 - pos); 
     470    strncat (buffylist + pos, ", ...", sizeof (buffylist) - 1 - pos); /* __STRNCAT_CHECKED__ */ 
    471471  } 
    472472  if (!first)