Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at duplicate.c:139

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

duplicate_read_records

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/deliver/duplicate.c)expand/collapse
Show more  
 92  duplicate_read_records(struct duplicate_file *file, struct istream *input,
 93                         unsigned int record_size)
 94  {
 95          const unsigned char *data;
 96          struct duplicate_record_header hdr;
 97          size_t size;
 98          unsigned int change_count;
 99   
 100          change_count = 0;
 101[+]         while (i_stream_read_data(input, &data, &size, record_size) > 0) {
 102                  if (record_size == sizeof(hdr))
 103                          memcpy(&hdr, data, sizeof(hdr));
 104                  else {
 105                          /* FIXME: backwards compatibility with v1.0 */
 106                          time_t stamp;
 107   
 108                          i_assert(record_size ==
 109                                   sizeof(time_t) + sizeof(uint32_t)*2);
 110                          memcpy(&stamp, data, sizeof(stamp));
 111                          hdr.stamp = stamp;
 112                          memcpy(&hdr.id_size, data + sizeof(time_t),
 113                                 sizeof(hdr.id_size));
 114                          memcpy(&hdr.user_size,
 115                                 data + sizeof(time_t) + sizeof(uint32_t),
 116                                 sizeof(hdr.user_size));
 117                  }
 118                  i_stream_skip(input, record_size);
 119   
 120                  if (hdr.id_size == 0 || hdr.user_size == 0 ||
 121                      hdr.id_size > DUPLICATE_BUFSIZE ||
 122                      hdr.user_size > DUPLICATE_BUFSIZE) {
 123                          i_error("broken duplicate file %s", file->path);
 124                          return -1;
 125                  }
 126   
 127                  if (i_stream_read_data(input, &data, &size,
 128[+]                                        hdr.id_size + hdr.user_size - 1) <= 0) {
 129                          i_error("unexpected end of file in %s", file->path);
 130                          return -1;
 131                  }
 132   
 133                  if ((time_t)hdr.stamp >= ioloop_time) {
 134                          /* still valid, save it */
 135                          struct duplicate *d;
 136                          void *new_id;
 137   
 138                          new_id = p_malloc(file->pool, hdr.id_size);
 139                          memcpy(new_id, data, hdr.id_size);
Show more  




Change Warning 8022.24463 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: