PennMUSH Community

Changeset 1042

Show
Ignore:
Timestamp:
07/10/07 11:49:48 (1 year ago)
Author:
shawnw
Message:

Convert some questionable strcat() calls to safe_str()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.2/branches/devel/src/extmail.c

    r1010 r1042  
    25432543  /* Return a longer description of message flags */ 
    25442544  static char tbuf1[BUFFER_LEN]; 
    2545  
    2546   tbuf1[0] = '\0'; 
     2545  char *tp; 
     2546 
     2547  tp = tbuf1; 
    25472548  if (Read(mp)) 
    2548     strcat(tbuf1, T("Read ")); 
     2549    safe_str(T("Read "), tbuf1, &tp); 
    25492550  else 
    2550     strcat(tbuf1, T("Unread ")); 
     2551    safe_str(T("Unread "), tbuf1, &tp); 
    25512552  if (Cleared(mp)) 
    2552     strcat(tbuf1, T("Cleared ")); 
     2553    safe_str(T("Cleared "), tbuf1, &tp); 
    25532554  if (Urgent(mp)) 
    2554     strcat(tbuf1, T("Urgent ")); 
     2555    safe_str(T("Urgent "), tbuf1, &tp); 
    25552556  if (Mass(mp)) 
    2556     strcat(tbuf1, T("Mass ")); 
     2557    safe_str(T("Mass "), tbuf1, &tp); 
    25572558  if (Forward(mp)) 
    2558     strcat(tbuf1, T("Fwd ")); 
     2559    safe_str(T("Fwd "), tbuf1, &tp); 
    25592560  if (Tagged(mp)) 
    2560     strcat(tbuf1, T("Tagged")); 
     2561    safe_str(T("Tagged"), tbuf1, &tp); 
     2562  *tp = '\0'; 
    25612563  return tbuf1; 
    25622564} 
     
    28032805 
    28042806  /* Handle this now so it doesn't clutter code */ 
    2805   tbuf1[0] = '\0'
     2807  j = 0
    28062808  if (flags & M_URGENT) 
    2807     strcat(tbuf1, "U")
     2809    tbuf1[j++] = 'U'
    28082810  if (flags & M_FORWARD) 
    2809     strcat(tbuf1, "F")
     2811    tbuf1[j++] = 'F'
    28102812  if (flags & M_REPLY) 
    2811     strcat(tbuf1, "R"); 
    2812  
    2813   arg = (char *) mush_malloc(BUFFER_LEN, "string"); 
    2814   arg2 = (char *) mush_malloc(BUFFER_LEN, "string"); 
    2815   arg3 = (char *) mush_malloc(BUFFER_LEN, "string"); 
    2816   arg4 = (char *) mush_malloc(BUFFER_LEN, "string"); 
     2813    tbuf1[j++] = 'R'; 
     2814  tbuf1[j] = '\0'; 
     2815 
     2816  arg = mush_malloc(BUFFER_LEN, "string"); 
     2817  arg2 = mush_malloc(BUFFER_LEN, "string"); 
     2818  arg3 = mush_malloc(BUFFER_LEN, "string"); 
     2819  arg4 = mush_malloc(BUFFER_LEN, "string"); 
    28172820  if (!arg4) 
    28182821    mush_panic("Unable to allocate memory in mailfilter"); 
     
    28372840                     PE_DEFAULT, PT_DEFAULT, NULL); 
    28382841  *bp = '\0'; 
    2839   free((Malloc_t) asave); 
     2842  free(asave); 
    28402843  if (*buff) { 
    28412844    sprintf(buf, "0:%d", mailnumber); 
     
    28432846  } 
    28442847 
    2845   mush_free((Malloc_t) arg, "string"); 
    2846   mush_free((Malloc_t) arg2, "string"); 
    2847   mush_free((Malloc_t) arg3, "string"); 
    2848   mush_free((Malloc_t) arg4, "string"); 
     2848  mush_free(arg, "string"); 
     2849  mush_free(arg2, "string"); 
     2850  mush_free(arg3, "string"); 
     2851  mush_free(arg4, "string"); 
    28492852  restore_global_env("filter_mail", wsave); 
    28502853  restore_global_regs("filter_mail", rsave); 
  • 1.8.2/branches/devel/src/warnings.c

    r1010 r1042  
    377377{ 
    378378  static char tbuf1[BUFFER_LEN]; 
     379  char *tp; 
    379380  int listsize, indexx; 
    380381 
    381   tbuf1[0] = '\0'
     382  tp = tbuf1
    382383 
    383384  /* Get the # of elements in checklist */ 
     
    391392       * if the bits set on the_flag is a subset of the bits set on warns 
    392393       */ 
    393       strcat(tbuf1, checklist[indexx].name); 
    394       strcat(tbuf1, " "); 
     394      safe_str(checklist[indexx].name, tbuf1, &tp); 
     395      safe_chr(' ', tbuf1, &tp); 
    395396      /* If we've got a flag which subsumes smaller ones, don't 
    396397       * list the smaller ones