Text   |  XML   |  ReML   |   Visible Warnings:

Ignored Return Value  at index-mail-headers.c:63

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

index_mail_parse_header_finish

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/index-mail-headers.c)expand/collapse
Show more  
 45  static void index_mail_parse_header_finish(struct index_mail *mail)
 46  {
 47          struct index_mail_line *lines;
 48          const unsigned char *header, *data;
 49          const uint8_t *match;
 50          buffer_t *buf;
 51          size_t data_size;
 52          unsigned int i, j, count, match_idx, match_count;
 53          bool noncontiguous;
 54   
 55          lines = array_get_modifiable(&mail->header_lines, &count);
 56   
 57          /* sort it first so fields are grouped together and ordered by 
 58             line number */
 59          qsort(lines, count, sizeof(*lines), header_line_cmp);
 60   
 61          match = array_get(&mail->header_match, &match_count);
 62          header = buffer_get_data(mail->header_data, NULL);
 63          buf = buffer_create_dynamic(pool_datastack_create(), 256);
 64   
 65          /* go through all the header lines we found */
 66          for (i = match_idx = 0; i < count; i = j) {
 67                  /* matches and header lines are both sorted, all matches
 68                     until lines[i] weren't found */
 69                  while (match_idx < lines[i].field_idx &&
 70                         match_idx < match_count) {
 71                          if (HEADER_MATCH_USABLE(mail, match[match_idx]) &&
 72                              mail_cache_field_can_add(mail->trans->cache_trans,
 73                                                       mail->data.seq,
 74                                                       match_idx)) {
 75                                  /* this header doesn't exist. remember that. */
 76                                  i_assert((match[match_idx] &
 77                                            HEADER_MATCH_FLAG_FOUND) == 0);
 78                                  index_mail_cache_add_idx(mail, match_idx,
 79                                                           NULL, 0);
 80                          }
 81                          match_idx++;
 82                  }
 83   
 84                  if (match_idx < match_count) {
 85                          /* save index to first header line */
 86                          j = i + 1;
 87                          array_idx_set(&mail->header_match_lines, match_idx, &j);
 88                          match_idx++;
 89                  }
 90   
 91                  if (!mail_cache_field_can_add(mail->trans->cache_trans,
 92                                                mail->data.seq,
 93                                                lines[i].field_idx)) {
 94                          /* header is already cached */
 95                          j = i + 1;
 96                          continue;
 97                  }
 98   
 99                  /* buffer contains: { uint32_t line_num[], 0, header texts }
 100                     noncontiguous is just a small optimization.. */
 101                  buffer_set_used_size(buf, 0);
 102                  buffer_append(buf, &lines[i].line_num,
 103                                sizeof(lines[i].line_num));
 104   
 105                  noncontiguous = FALSE;
 106                  for (j = i+1; j < count; j++) {
 107                          if (lines[j].field_idx != lines[i].field_idx)
 108                                  break;
 109   
 110                          if (lines[j].start_pos != lines[j-1].end_pos)
 111                                  noncontiguous = TRUE;
 112                          buffer_append(buf, &lines[j].line_num,
 113                                        sizeof(lines[j].line_num));
 114                  }
 115                  buffer_append_zero(buf, sizeof(uint32_t));
 116   
 117                  if (noncontiguous) {
 118                          for (; i < j; i++) {
 119                                  buffer_append(buf, header + lines[i].start_pos,
 120                                                lines[i].end_pos -
 121                                                lines[i].start_pos);
 122                          }
 123                          i--;
 124                  } else {
 125                          buffer_append(buf, header + lines[i].start_pos,
 126                                        lines[j-1].end_pos - lines[i].start_pos);
 127                  }
 128   
 129                  data = buffer_get_data(buf, &data_size);
 130                  index_mail_cache_add_idx(mail, lines[i].field_idx,
 131                                           data, data_size);
 132          }
 133   
 134          for (; match_idx < match_count; match_idx++) {
 135                  if (HEADER_MATCH_USABLE(mail, match[match_idx]) &&
 136                      mail_cache_field_can_add(mail->trans->cache_trans,
 137                                               mail->data.seq,
 138                                               match_idx)) {
 139                          /* this header doesn't exist. remember that. */
 140                          i_assert((match[match_idx] &
 141                                    HEADER_MATCH_FLAG_FOUND) == 0);
 142                          index_mail_cache_add_idx(mail, match_idx, NULL, 0);
 143                  }
 144          }
 145   
 146          mail->data.dont_cache_field_idx = -1U;
 147  }
Show more  




Change Warning 8169.26076 : Ignored Return Value

Priority:
State:
Finding:
Owner:
Note: