PennMUSH Community

Changeset 904

Show
Ignore:
Timestamp:
06/09/07 11:02:27 (1 year ago)
Author:
shawnw
Message:

Fix potential wild.c problems from last fix.

Files:

Legend:

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

    r902 r904  
    468468 
    469469/** Wildcard match, possibly case-sensitive, and remember the wild data 
    470  *  in global_eval_context.wnxt
     470 *  in matches, storing them in data
    471471 * 
    472472 * This routine will cause crashes if fed NULLs instead of strings. 
     
    486486int 
    487487wild_match_case_r(const char *RESTRICT s, const char *RESTRICT d, int cs, 
    488           char **ary, int max, char *data, int len) 
    489 
    490   /* Clear %0-%9 and r(0) - r(9) */ 
    491   return wild(s, d, 0, cs, ary, max, data, len); 
     488          char **matches, int nmatches, char *data, int len) 
     489
     490  int n; 
     491 
     492  for (n = 0; n < nmatches; n++) 
     493    matches[n] = NULL; 
     494 
     495  return wild(s, d, 0, cs, matches, nmatches, data, len); 
    492496} 
    493497 
     
    520524  int subpatterns; 
    521525 
     526  for (i = 0; i < nmatches; i++) 
     527    matches[i] = NULL; 
     528 
    522529  if ((re = pcre_compile(s, (cs ? 0 : PCRE_CASELESS), &errptr, &erroffset, 
    523530             tables)) == NULL) { 
     
    553560   */ 
    554561 
    555   for (i = 0; i < nmatches && len > 1; i++) { 
     562  for (i = 0; i < nmatches && i < subpatterns && len > 1; i++) { 
    556563    int sublen; 
    557564    const char *submatch;