Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at squat-trie.c:411

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

node_split_string

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/fts-squat/squat-trie.c)expand/collapse
Show more  
 649  node_split_string(struct squat_trie_build_context *ctx, struct squat_node *node)
 650  {
 651          struct squat_node *child;
 652          unsigned char *str;
 653          unsigned int uid, idx, leafstr_len = node->leaf_string_length;
 654   
 655          i_assert(leafstr_len > 0);
 656   
 657          /* make a copy of the leaf string and convert to normal node by 
 658             removing it. */
 659          str = t_malloc(leafstr_len);
 660          if (!NODE_IS_DYNAMIC_LEAF(node))
 661                  memcpy(str, node->children.static_leaf_string, leafstr_len);
 662          else {
 663                  memcpy(str, node->children.leaf_string, leafstr_len);
 664                  i_free(node->children.leaf_string);
 665          }
 666          node->leaf_string_length = 0;
 667   
 668          /* create a new child node for the rest of the string */
 669[+]         idx = node_add_child(ctx->trie, node, str[0], MAX_FAST_LEVEL);
expand/collapse

node_add_child

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/fts-squat/squat-trie.c)expand/collapse
Show more  
 367  node_add_child(struct squat_trie *trie, struct squat_node *node,
 368                 unsigned char chr, int level)
 369  {
 370          unsigned int old_child_count = node->child_count;
 371          struct squat_node *children, *old_children;
 372          unsigned char *chars;
 373          size_t old_size, new_size;
 374   
 375          i_assert(node->leaf_string_length == 0);
 376   
 377          if (node->want_sequential) {
 378                  node_make_squential(trie, node, level);
 379   
 380                  if (chr < SEQUENTIAL_COUNT)
 381                          return chr;
 382                  old_child_count = SEQUENTIAL_COUNT;
 383          }
 384   
 385          node->child_count++;
 386          new_size = NODE_CHILDREN_ALLOC_SIZE(node->child_count);
 387   
 388          if (old_child_count == 0) {
 389                  /* first child */
 390                  node->children.data = i_malloc(new_size);
 391                  trie->node_alloc_size += new_size;
 392                  children = NODE_CHILDREN_NODES(node);
 393          } else {
 394                  old_size = NODE_CHILDREN_ALLOC_SIZE(old_child_count);
 395                  if (old_size != new_size) {
 396                          trie->node_alloc_size += new_size - old_size;
 397                          node->children.data = i_realloc(node->children.data,
 398                                                          old_size, new_size);
 399                  }
 400   
 401                  children = NODE_CHILDREN_NODES(node);
 402                  old_children = (void *)(NODE_CHILDREN_CHARS(node) +
 403                                          MEM_ALIGN(old_child_count));
 404                  if (children != old_children) {
 405                          memmove(children, old_children,
 406                                  old_child_count * sizeof(struct squat_node));
 407                  }
 408          }
 409   
 410          chars = NODE_CHILDREN_CHARS(node);
 411          chars[node->child_count - 1] = chr;
Show more  
Show more  




Change Warning 8091.24705 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: