Print this page
10140 notify_params.c is walking past end of array

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/svc/common/notify_params.c
          +++ new/usr/src/cmd/svc/common/notify_params.c
↓ open down ↓ 79 lines elided ↑ open up ↑
  80   80  };
  81   81  
  82   82  /*
  83   83   * get_fma_tag()
  84   84   * return a pointer to the fma tag at the passed index. NULL if no entry exist
  85   85   * for index
  86   86   */
  87   87  const char *
  88   88  get_fma_tag(uint32_t index)
  89   89  {
  90      -        if (index > (sizeof (fma_tags) / sizeof (struct fma_tags)))
       90 +        if (index >= (sizeof (fma_tags) / sizeof (struct fma_tags)))
  91   91                  return (NULL);
  92   92  
  93   93          return (fma_tags[index].t);
  94   94  }
  95   95  
  96   96  /*
  97   97   * get_fma_class()
  98   98   * return a pointer to the fma class at the passed index. NULL if no entry exist
  99   99   * for index
 100  100   */
 101  101  const char *
 102  102  get_fma_class(uint32_t index)
 103  103  {
 104      -        if (index > (sizeof (fma_tags) / sizeof (struct fma_tags)))
      104 +        if (index >= (sizeof (fma_tags) / sizeof (struct fma_tags)))
 105  105                  return (NULL);
 106  106  
 107  107          return (fma_tags[index].s);
 108  108  }
 109  109  
 110  110  /*
 111  111   * is_fma_token()
 112  112   * check if the parameter is an fma token by comparing with the
 113  113   * fma_classes[] and the fma_tags[] arrays.
 114  114   */
↓ open down ↓ 219 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX