Print this page
code review

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/libld/common/syms.c
          +++ new/usr/src/cmd/sgs/libld/common/syms.c
↓ open down ↓ 28 lines elided ↑ open up ↑
  29   29  
  30   30  /*
  31   31   * Symbol table management routines
  32   32   */
  33   33  
  34   34  #define ELF_TARGET_AMD64
  35   35  
  36   36  #include        <stdio.h>
  37   37  #include        <string.h>
  38   38  #include        <debug.h>
  39      -#include        <alloca.h>
  40   39  #include        "msg.h"
  41   40  #include        "_libld.h"
  42   41  
  43   42  /*
  44   43   * AVL tree comparator function:
  45   44   *
  46   45   * The primary key is the symbol name hash with a secondary key of the symbol
  47   46   * name itself.
  48   47   */
  49   48  int
↓ open down ↓ 846 lines elided ↑ open up ↑
 896  895  sym_add_bounds(Ofl_desc *ofl, Os_desc *osp, Word bound)
 897  896  {
 898  897          Sym_desc *bsdp;
 899  898          char symn[1024];
 900  899          size_t nsz;
 901  900  
 902  901          switch (bound) {
 903  902          case SDAUX_ID_SECBOUND_START:
 904  903                  nsz = snprintf(symn, sizeof (symn), "%s%s",
 905  904                      MSG_ORIG(MSG_SYM_SECBOUND_START), osp->os_name + 1);
 906      -                if (nsz > sizeof (symn))
      905 +                if (nsz >= sizeof (symn))
 907  906                          return;
 908  907                  break;
 909  908          case SDAUX_ID_SECBOUND_STOP:
 910  909                  nsz = snprintf(symn, sizeof (symn), "%s%s",
 911  910                      MSG_ORIG(MSG_SYM_SECBOUND_STOP), osp->os_name + 1);
 912      -                if (nsz > sizeof (symn))
      911 +                if (nsz >= sizeof (symn))
 913  912                          return;
 914  913                  break;
 915  914          default:
 916  915                  assert(0);
 917  916          }
 918  917  
 919  918          if ((bsdp = ld_sym_find(symn, SYM_NOHASH, NULL, ofl)) != NULL) {
 920  919                  if ((bsdp->sd_shndx != SHN_UNDEF) &&
 921  920                      (bsdp->sd_ref == REF_REL_NEED)) {
 922  921                          ld_eprintf(ofl, ERR_WARNING, MSG_INTL(MSG_SYM_RESERVE),
↓ open down ↓ 31 lines elided ↑ open up ↑
 954  953          if (ofl->ofl_flags & FLG_OF_RELOBJ)
 955  954                  return (1);
 956  955  
 957  956          DBG_CALL(Dbg_syms_spec_title(ofl->ofl_lml));
 958  957  
 959  958          /*
 960  959           * For each section in the output file, look for symbols named for the
 961  960           * __start/__stop patterns.  If references exist, flesh the symbols to
 962  961           * be defined.
 963  962           *
 964      -         * the symbols are given values at the same time as the other special
      963 +         * The symbols are given values at the same time as the other special
 965  964           * symbols.
 966  965           */
 967  966          for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) {
 968  967                  Os_desc *osp;
 969  968                  Aliste idx2;
 970  969  
 971  970                  for (APLIST_TRAVERSE(sgp->sg_osdescs, idx2, osp)) {
 972  971                          sym_add_bounds(ofl, osp, SDAUX_ID_SECBOUND_START);
 973  972                          sym_add_bounds(ofl, osp, SDAUX_ID_SECBOUND_STOP);
 974  973                  }
↓ open down ↓ 2236 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX