PennMUSH Community

Changeset 1041

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

Convert some questionable strcat() calls to safe_str()

Files:

Legend:

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

    r967 r1041  
    25622562  /* Return a longer description of message flags */ 
    25632563  static char tbuf1[BUFFER_LEN]; 
    2564  
    2565   tbuf1[0] = '\0'; 
     2564  char *tp; 
     2565 
     2566  tp = tbuf1; 
    25662567  if (Read(mp)) 
    2567     strcat(tbuf1, T("Read ")); 
     2568    safe_str(T("Read "), tbuf1, &tp); 
    25682569  else 
    2569     strcat(tbuf1, T("Unread ")); 
     2570    safe_str(T("Unread "), tbuf1, &tp); 
    25702571  if (Cleared(mp)) 
    2571     strcat(tbuf1, T("Cleared ")); 
     2572    safe_str(T("Cleared "), tbuf1, &tp); 
    25722573  if (Urgent(mp)) 
    2573     strcat(tbuf1, T("Urgent ")); 
     2574    safe_str(T("Urgent "), tbuf1, &tp); 
    25742575  if (Mass(mp)) 
    2575     strcat(tbuf1, T("Mass ")); 
     2576    safe_str(T("Mass "), tbuf1, &tp); 
    25762577  if (Forward(mp)) 
    2577     strcat(tbuf1, T("Fwd ")); 
     2578    safe_str(T("Fwd "), tbuf1, &tp); 
    25782579  if (Tagged(mp)) 
    2579     strcat(tbuf1, T("Tagged")); 
     2580    safe_str(T("Tagged"), tbuf1, &tp); 
     2581  *tp = '\0'; 
    25802582  return tbuf1; 
    25812583} 
     
    28222824 
    28232825  /* Handle this now so it doesn't clutter code */ 
    2824   tbuf1[0] = '\0'
     2826  j = 0
    28252827  if (flags & M_URGENT) 
    2826     strcat(tbuf1, "U")
     2828    tbuf1[j++] = 'U'
    28272829  if (flags & M_FORWARD) 
    2828     strcat(tbuf1, "F")
     2830    tbuf1[j++] = 'F'
    28292831  if (flags & M_REPLY) 
    2830     strcat(tbuf1, "R"); 
    2831  
    2832   arg = (char *) mush_malloc(BUFFER_LEN, "string"); 
    2833   arg2 = (char *) mush_malloc(BUFFER_LEN, "string"); 
    2834   arg3 = (char *) mush_malloc(BUFFER_LEN, "string"); 
    2835   arg4 = (char *) mush_malloc(BUFFER_LEN, "string"); 
     2832    tbuf1[j++] = 'R'; 
     2833  tbuf1[j] = '\0'; 
     2834 
     2835  arg = mush_malloc(BUFFER_LEN, "string"); 
     2836  arg2 = mush_malloc(BUFFER_LEN, "string"); 
     2837  arg3 = mush_malloc(BUFFER_LEN, "string"); 
     2838  arg4 = mush_malloc(BUFFER_LEN, "string"); 
    28362839  if (!arg4) 
    28372840    mush_panic("Unable to allocate memory in mailfilter"); 
     
    28562859                     PE_DEFAULT, PT_DEFAULT, NULL); 
    28572860  *bp = '\0'; 
    2858   free((Malloc_t) asave); 
     2861  free(asave); 
    28592862  if (*buff) { 
    28602863    sprintf(buf, "0:%d", mailnumber); 
     
    28622865  } 
    28632866 
    2864   mush_free((Malloc_t) arg, "string"); 
    2865   mush_free((Malloc_t) arg2, "string"); 
    2866   mush_free((Malloc_t) arg3, "string"); 
    2867   mush_free((Malloc_t) arg4, "string"); 
     2867  mush_free(arg, "string"); 
     2868  mush_free(arg2, "string"); 
     2869  mush_free(arg3, "string"); 
     2870  mush_free(arg4, "string"); 
    28682871  restore_global_env("filter_mail", wsave); 
    28692872  restore_global_regs("filter_mail", rsave); 
  • 1.8.3/branches/devel/src/warnings.c

    r905 r1041  
    378378{ 
    379379  static char tbuf1[BUFFER_LEN]; 
     380  char *tp; 
    380381  int listsize, indexx; 
    381382 
    382   tbuf1[0] = '\0'
     383  tp = tbuf1
    383384 
    384385  /* Get the # of elements in checklist */ 
     
    392393       * if the bits set on the_flag is a subset of the bits set on warns 
    393394       */ 
    394       strcat(tbuf1, checklist[indexx].name); 
    395       strcat(tbuf1, " "); 
     395      safe_str(checklist[indexx].name, tbuf1, &tp); 
     396      safe_chr(' ', tbuf1, &tp); 
    396397      /* If we've got a flag which subsumes smaller ones, don't 
    397398       * list the smaller ones 
     
    400401    } 
    401402  } 
     403  *tp = '\0'; 
    402404  return tbuf1; 
    403405}