Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at mail-transaction-log-view.c:224

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

mail_transaction_log_view_set

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-index/mail-transaction-log-view.c)expand/collapse
Show more  
 96  int mail_transaction_log_view_set(struct mail_transaction_log_view *view,
 97                                    uint32_t min_file_seq, uoff_t min_file_offset,
 98                                    uint32_t max_file_seq, uoff_t max_file_offset,
 99                                    bool *reset_r)
 100  {
 101          struct mail_transaction_log_file *file, *const *files;
 102          uoff_t start_offset, end_offset;
 103          unsigned int i;
 104          uint32_t seq;
 105          int ret;
 106   
 107          i_assert(view->log != NULL);
 108          i_assert(min_file_seq <= max_file_seq);
 109   
 110          *reset_r = FALSE;
 111   
 112          if (view->log == NULL) {
 113                  /* transaction log is closed already. this log view shouldn't
 114                     be used anymore. */
 115                  return -1;
 116          }
 117   
 118          if (min_file_seq == 0) {
 119                  /* index file doesn't exist yet. this transaction log should
 120                     start from the beginning */
 121                  if (view->log->files->hdr.prev_file_seq != 0) {
 122                          /* but it doesn't */
 123                          return 0;
 124                  }
 125   
 126                  min_file_seq = view->log->files->hdr.file_seq;
 127                  min_file_offset = 0;
 128   
 129                  if (max_file_seq == 0) {
 130                          max_file_seq = min_file_seq;
 131                          max_file_offset = min_file_offset;
 132                  }
 133          }  
 134   
 135          if (min_file_seq == view->log->files->hdr.prev_file_seq &&
 136              min_file_offset == view->log->files->hdr.prev_file_offset) {
 137                  /* we can skip this */
 138                  min_file_seq = view->log->files->hdr.file_seq;
 139                  min_file_offset = 0;
 140   
 141                  if (min_file_seq > max_file_seq) {
 142                          /* empty view */
 143                          max_file_seq = min_file_seq;
 144                          max_file_offset = min_file_offset;
 145                  }
 146          }
 147   
 148          if (min_file_seq == max_file_seq && min_file_offset > max_file_offset) {
 149                  /* log file offset is probably corrupted in the index file. */
 150                  mail_transaction_log_view_set_corrupted(view,
 151                          "file_seq=%u, min_file_offset (%"PRIuUOFF_T
 152                          ") > max_file_offset (%"PRIuUOFF_T")",
 153                          min_file_seq, min_file_offset, max_file_offset);
 154                  return -1;
 155          }
 156   
 157          if (min_file_offset > 0 &&
 158              min_file_offset < view->log->files->hdr.hdr_size) {
 159                  /* log file offset is probably corrupted in the index file. */
 160                  mail_transaction_log_view_set_corrupted(view,
 161                          "file_seq=%u, min_file_offset (%"PRIuUOFF_T
 162                          ") < hdr_size (%u)",
 163                          min_file_seq, min_file_offset,
 164                          view->log->files->hdr.hdr_size);
 165                  return -1;
 166          }
 167   
 168          view->tail = view->head = file = NULL;
 169          for (seq = min_file_seq; seq <= max_file_seq; seq++) {
 170                  if (file == NULL || file->hdr.file_seq != seq) {
 171                          /* see if we could find the missing file. if we know 
 172                             the max. file sequence, make sure NFS attribute
 173                             cache gets flushed if necessary. */
 174                          bool nfs_flush = max_file_seq != (uint32_t)-1;
 175   
 176                          ret = mail_transaction_log_find_file(view->log, seq,
 177                                                               nfs_flush, &file);
 178                          if (ret <= 0) {
 179                                  if (ret < 0)
 180
211
Show [ Lines 180 to 211 omitted. ]
 212                          seq = file->hdr.file_seq;
 213                          view->tail = NULL;
 214                  }  
 215   
 216                  if (view->tail == NULL)
 217                          view->tail = file;
 218                  view->head = file;
 219                  file = file->next;
 220          }
 221   
 222          if (min_file_offset == 0) {
 223                  /* beginning of the file */
 224                  min_file_offset = view->tail->hdr.hdr_size;
Show more  




Change Warning 7208.25712 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: