Print this page
12786 fix CTF pointer overrun
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Approved by: Dan McDonald <danmcd@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/common/ctf/ctf_lookup.c
          +++ new/usr/src/common/ctf/ctf_lookup.c
↓ open down ↓ 125 lines elided ↑ open up ↑
 126  126  
 127  127                          q = p + 1;
 128  128                          continue;
 129  129                  }
 130  130  
 131  131                  if (isqualifier(p, (size_t)(q - p)))
 132  132                          continue; /* skip qualifier keyword */
 133  133  
 134  134                  for (lp = fp->ctf_lookups; lp->ctl_prefix != NULL; lp++) {
 135  135                          if (lp->ctl_prefix[0] == '\0' ||
 136      -                            strncmp(p, lp->ctl_prefix, (size_t)(q - p)) == 0) {
      136 +                            ((size_t)(q - p) >= lp->ctl_len && strncmp(p,
      137 +                            lp->ctl_prefix, (size_t)(q - p)) == 0)) {
 137  138                                  for (p += lp->ctl_len; isspace(*p); p++)
 138  139                                          continue; /* skip prefix and next ws */
 139  140  
 140  141                                  if ((q = strchr(p, '*')) == NULL)
 141  142                                          q = end;  /* compare until end */
 142  143  
 143  144                                  while (isspace(q[-1]))
 144  145                                          q--;      /* exclude trailing ws */
 145  146  
 146  147                                  if ((hp = ctf_hash_lookup(lp->ctl_hash, fp, p,
↓ open down ↓ 216 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX