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


  70         { "problem-updated", "list.updated" },
  71         { "problem-repaired", "list.repaired" },
  72         { "problem-resolved", "list.resolved" },
  73         { NULL, NULL }
  74 };
  75 
  76 static char *fma_classes[] = {
  77         "list.",
  78         "ireport.",
  79         NULL
  80 };
  81 
  82 /*
  83  * get_fma_tag()
  84  * return a pointer to the fma tag at the passed index. NULL if no entry exist
  85  * for index
  86  */
  87 const char *
  88 get_fma_tag(uint32_t index)
  89 {
  90         if (index > (sizeof (fma_tags) / sizeof (struct fma_tags)))
  91                 return (NULL);
  92 
  93         return (fma_tags[index].t);
  94 }
  95 
  96 /*
  97  * get_fma_class()
  98  * return a pointer to the fma class at the passed index. NULL if no entry exist
  99  * for index
 100  */
 101 const char *
 102 get_fma_class(uint32_t index)
 103 {
 104         if (index > (sizeof (fma_tags) / sizeof (struct fma_tags)))
 105                 return (NULL);
 106 
 107         return (fma_tags[index].s);
 108 }
 109 
 110 /*
 111  * is_fma_token()
 112  * check if the parameter is an fma token by comparing with the
 113  * fma_classes[] and the fma_tags[] arrays.
 114  */
 115 int
 116 is_fma_token(const char *t)
 117 {
 118         int i;
 119 
 120         for (i = 0; fma_classes[i]; ++i)
 121                 if (strncmp(t, fma_classes[i], strlen(fma_classes[i])) == 0)
 122                         return (1);
 123 
 124         for (i = 0; fma_tags[i].t; ++i)




  70         { "problem-updated", "list.updated" },
  71         { "problem-repaired", "list.repaired" },
  72         { "problem-resolved", "list.resolved" },
  73         { NULL, NULL }
  74 };
  75 
  76 static char *fma_classes[] = {
  77         "list.",
  78         "ireport.",
  79         NULL
  80 };
  81 
  82 /*
  83  * get_fma_tag()
  84  * return a pointer to the fma tag at the passed index. NULL if no entry exist
  85  * for index
  86  */
  87 const char *
  88 get_fma_tag(uint32_t index)
  89 {
  90         if (index >= (sizeof (fma_tags) / sizeof (struct fma_tags)))
  91                 return (NULL);
  92 
  93         return (fma_tags[index].t);
  94 }
  95 
  96 /*
  97  * get_fma_class()
  98  * return a pointer to the fma class at the passed index. NULL if no entry exist
  99  * for index
 100  */
 101 const char *
 102 get_fma_class(uint32_t index)
 103 {
 104         if (index >= (sizeof (fma_tags) / sizeof (struct fma_tags)))
 105                 return (NULL);
 106 
 107         return (fma_tags[index].s);
 108 }
 109 
 110 /*
 111  * is_fma_token()
 112  * check if the parameter is an fma token by comparing with the
 113  * fma_classes[] and the fma_tags[] arrays.
 114  */
 115 int
 116 is_fma_token(const char *t)
 117 {
 118         int i;
 119 
 120         for (i = 0; fma_classes[i]; ++i)
 121                 if (strncmp(t, fma_classes[i], strlen(fma_classes[i])) == 0)
 122                         return (1);
 123 
 124         for (i = 0; fma_tags[i].t; ++i)