Changeset f98c74e


Ignore:
Timestamp:
Apr 5, 2009, 7:36:53 PM (12 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
owl
Children:
51b6c7c
Parents:
9948234
Message:
Fix some strcpy's that could be vulnerable
Remove an unused function
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r9948234 rf98c74e  
    11$Id$
     2
     32.2.1
     4        Fix some strcpy's that could be vulnerable
     5        Remove an unused function
    26
    372.2.0
  • functions.c

    re01449c rf98c74e  
    290290{
    291291  owl_editwin *e;
    292   char buff[1024];
     292  char *buff;
    293293  owl_zwrite z;
    294294  int ret;
     
    320320  owl_editwin_clear(e);
    321321  owl_editwin_set_dotsend(e);
    322   strcpy(buff, "----> ");
    323   strcat(buff, line);
    324   strcat(buff, "\n");
     322  buff=owl_sprintf("----> %s\n", line);
    325323  owl_editwin_set_locktext(e, buff);
    326324
    327   /* make it active */
    328325  owl_global_set_typwin_active(&g);
    329326
    330327  owl_global_set_buffercommand(&g, line);
     328  owl_free(buff);
    331329}
    332330
     
    334332{
    335333  owl_editwin *e;
    336   char buff[1024];
     334  char *buff;
    337335
    338336  /* check the arguments */
     
    350348  owl_editwin_clear(e);
    351349  owl_editwin_set_dotsend(e);
    352   strcpy(buff, "----> ");
    353   strcat(buff, line);
    354   strcat(buff, "\n");
     350  buff=owl_sprintf("----> %s\n", line);
    355351  owl_editwin_set_locktext(e, buff);
    356352
    357   /* make it active */
    358353  owl_global_set_typwin_active(&g);
    359354
    360355  owl_global_set_buffercommand(&g, line);
     356  owl_free(buff);
    361357}
    362358
  • message.c

    rfa00c5c rf98c74e  
    590590int owl_message_is_burningears(owl_message *m)
    591591{
    592   /* we should add a global to cache the short zsender */
    593   char sender[LINE], *ptr;
     592  char *name;
     593  int ret;
    594594
    595595  /* if the message is from us or to us, it doesn't count */
     
    597597
    598598  if (owl_message_is_type_zephyr(m)) {
    599     strcpy(sender, owl_zephyr_get_sender());
    600     ptr=strchr(sender, '@');
    601     if (ptr) *ptr='\0';
     599    name=short_zuser(owl_zephyr_get_sender());
    602600  } else if (owl_message_is_type_aim(m)) {
    603     strcpy(sender, owl_global_get_aim_screenname(&g));
     601    name=owl_strdup(owl_global_get_aim_screenname(&g));
    604602  } else {
    605603    return(0);
    606604  }
    607605
    608   if (stristr(owl_message_get_body(m), sender)) {
    609     return(1);
    610   }
    611   return(0);
     606  if (stristr(owl_message_get_body(m), name)) {
     607    ret=1;
     608  } else {
     609    ret=0;
     610  }
     611
     612  owl_free(name);
     613  return(ret);
    612614}
    613615
  • owl.h

    r6fdef66 rf98c74e  
    4646static const char owl_h_fileIdent[] = "$Id$";
    4747
    48 #define OWL_VERSION         2.2.0
    49 #define OWL_VERSION_STRING "2.2.0"
     48#define OWL_VERSION         2.2.1
     49#define OWL_VERSION_STRING "2.2.1-pre-1"
    5050
    5151/* Feature that is being tested to redirect stderr through a pipe.
  • perlconfig.c

    rfa00c5c rf98c74e  
    179179  int ret, fd;
    180180  PerlInterpreter *p;
    181   char filename[1024];
     181  char filename[MAXPATHLEN];
    182182  char *embedding[5];
    183183  char *err;
  • stylefunc.c

    rfa00c5c rf98c74e  
    3434{
    3535#ifdef HAVE_LIBZEPHYR
    36   char *body, *indent, *ptr, *zsigbuff, frombuff[LINE];
     36  char *body, *indent, *ptr, *zsigbuff, *frombuff;
    3737  ZNotice_t *n;
    3838#endif
     
    5656   
    5757    /* edit the from addr for printing */
    58     strcpy(frombuff, owl_message_get_sender(m));
    59     ptr=strchr(frombuff, '@');
    60     if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) {
    61       *ptr='\0';
    62     }
     58    frombuff=short_zuser(owl_message_get_sender(m));
    6359   
    6460    /* set the message for printing */
     
    131127    owl_free(body);
    132128    owl_free(indent);
     129    owl_free(frombuff);
    133130#endif
    134131  } else if (owl_message_is_type_zephyr(m) && owl_message_is_direction_out(m)) {
     
    243240  char *shorttimestr;
    244241#ifdef HAVE_LIBZEPHYR
    245   char *body, *indent, *ptr, *zsigbuff, frombuff[LINE];
     242  char *body, *indent, *ptr, *zsigbuff, *frombuff;
    246243  ZNotice_t *n;
    247244#endif
     
    267264   
    268265    /* edit the from addr for printing */
    269     strcpy(frombuff, owl_message_get_sender(m));
    270     ptr=strchr(frombuff, '@');
    271     if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) {
    272       *ptr='\0';
    273     }
     266    frombuff=short_zuser(owl_message_get_sender(m));
    274267   
    275268    /* set the message for printing */
     
    348341    owl_free(body);
    349342    owl_free(indent);
     343    owl_free(frombuff);
    350344#endif
    351345  } else if (owl_message_is_type_zephyr(m) && owl_message_is_direction_out(m)) {
     
    604598{
    605599#ifdef HAVE_LIBZEPHYR
    606   char *body, *indent, *ptr, frombuff[LINE];
     600  char *body, *indent, *ptr, *frombuff;
    607601  owl_fmtext fm_first, fm_other, fm_tmp;
    608602  ZNotice_t *n;
     
    640634   
    641635    /* edit the from addr for printing */
    642     strcpy(frombuff, owl_message_get_sender(m));
    643     ptr=strchr(frombuff, '@');
    644     if (ptr && !strncmp(ptr+1, owl_zephyr_get_realm(), strlen(owl_zephyr_get_realm()))) {
    645       *ptr='\0';
    646     }
     636    frombuff=short_zuser(owl_message_get_sender(m));
    647637    sender=owl_sprintf("%-9.9s", frombuff);
    648638
     
    707697
    708698    owl_free(sender);
     699    owl_free(frombuff);
    709700    owl_free(hostname);
    710701    owl_free(timestr);
  • text.c

    rfa00c5c rf98c74e  
    351351  tolen  = strlen(to);
    352352  fromlen  = strlen(from);
    353   out = malloc(outlen);
     353  out = owl_malloc(outlen);
    354354
    355355  while (in[inpos]) {
  • zephyr.c

    rf19fef4 rf98c74e  
    100100  FILE *file;
    101101  char *tmp, *start;
    102   char buffer[1024], subsfile[1024];
     102  char buffer[1024], subsfile[MAXPATHLEN];
    103103  ZSubscription_t subs[3001];
    104104  int count, ret;
     
    188188  FILE *file;
    189189  ZSubscription_t subs[3001];
    190   char subsfile[1024], buffer[1024];
     190  char subsfile[MAXPATHLEN], buffer[1024];
    191191  int count, ret, i;
    192192  struct stat statbuff;
     
    674674{
    675675#ifdef HAVE_LIBZEPHYR
    676   char *line, subsfile[LINE], buff[LINE];
     676  char *line, subsfile[MAXPATHLEN], buff[LINE];
    677677  FILE *file;
    678678
  • zwrite.c

    rfa00c5c rf98c74e  
    352352}
    353353
    354 void owl_zwrite_get_recipstr(owl_zwrite *z, char *buff)
    355 {
    356   int i, j;
    357 
    358   strcpy(buff, "");
    359   j=owl_list_get_size(&(z->recips));
    360   for (i=0; i<j; i++) {
    361     strcat(buff, owl_list_get_element(&(z->recips), i));
    362     strcat(buff, " ");
    363   }
    364   buff[strlen(buff)-1]='\0';
    365 }
    366 
    367354int owl_zwrite_get_numrecips(owl_zwrite *z)
    368355{
Note: See TracChangeset for help on using the changeset viewer.