Fossil

Check-in [c66083ed]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Revise TH1 proc_command fix from the previous check-in so it more closely matches the original fix from [f2d87242503d7a7d].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c66083eded992cc24e842cd133bfb47c95f638d9
User & Date: mistachkin 2015-11-21 18:37:41
Context
2015-11-22
05:30
Restore historical behavior of allowing both pull-only and pullonly in autosync setting. check-in: acc0200a user: andybradford tags: trunk
2015-11-21
18:37
Revise TH1 proc_command fix from the previous check-in so it more closely matches the original fix from [f2d87242503d7a7d]. check-in: c66083ed user: mistachkin tags: trunk
17:25
If the proc argument list is an empty list, don't segfault by accessing memory outside the bounds of the array. For example, as used in the footer /artifact/7f36cbf30a82ef3cec30c1917a96415fa7d76eeb?txt=1&ln=3 check-in: 7c3cb470 user: andybradford tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/th_lang.c.

493
494
495
496
497
498
499
500
501
502
503

504
505
506
507
508
509
510
      argl[2];    /* Space for copies of parameter names and default values */
  p = (ProcDefn *)Th_Malloc(interp, nByte);

  /* If the last parameter in the parameter list is "args", then set the
  ** ProcDefn.hasArgs flag. The "args" parameter does not require an
  ** entry in the ProcDefn.azParam[] or ProcDefn.azDefault[] arrays.
  */
  if( nParam
      && anParam[nParam-1]==4 && 0==memcmp(azParam[nParam-1], "args", 4) ){
    p->hasArgs = 1;
    nParam--;

  }

  p->nParam    = nParam;
  p->azParam   = (char **)&p[1];
  p->anParam   = (int *)&p->azParam[nParam];
  p->azDefault = (char **)&p->anParam[nParam];
  p->anDefault = (int *)&p->azDefault[nParam];







|
|
|
|
>







493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
      argl[2];    /* Space for copies of parameter names and default values */
  p = (ProcDefn *)Th_Malloc(interp, nByte);

  /* If the last parameter in the parameter list is "args", then set the
  ** ProcDefn.hasArgs flag. The "args" parameter does not require an
  ** entry in the ProcDefn.azParam[] or ProcDefn.azDefault[] arrays.
  */
  if( nParam>0 ){
    if( anParam[nParam-1]==4 && 0==memcmp(azParam[nParam-1], "args", 4) ){
      p->hasArgs = 1;
      nParam--;
    }
  }

  p->nParam    = nParam;
  p->azParam   = (char **)&p[1];
  p->anParam   = (int *)&p->azParam[nParam];
  p->azDefault = (char **)&p->anParam[nParam];
  p->anDefault = (int *)&p->azDefault[nParam];