Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at mailbox-list.c:225

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

shared_create

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/shared/shared-storage.c)expand/collapse
Show more  
 41  static int shared_create(struct mail_storage *_storage, const char *data,
 42                           const char **error_r)
 43  {
 44          struct shared_storage *storage = (struct shared_storage *)_storage;
 45          struct mailbox_list_settings list_set;
 46          const char *driver, *p;
 47          char *wildcardp;
 48          bool have_username;
 49   
 50          /* data must begin with the actual mailbox driver */
 51          p = strchr(data, ':');
 52          if (p == NULL) {
 53                  *error_r = "Shared mailbox location not prefixed with driver";
 54                  return -1;
 55          }
 56          driver = t_strdup_until(data, p);
 57          storage->location = p_strdup(_storage->pool, data);
 58          storage->storage_class = mail_storage_find_class(driver);
 59          if (storage->storage_class == NULL) {
 60                  *error_r = t_strconcat("Unknown shared storage driver: ",
 61                                         driver, NULL);
 62                  return -1;
 63          }
 64          _storage->mailbox_is_file = storage->storage_class->mailbox_is_file;
 65   
 66          wildcardp = strchr(_storage->ns->prefix, '%');
 67          if (wildcardp == NULL) {
 68                  *error_r = "Shared namespace prefix doesn't contain %";
 69                  return -1;
 70          }
 71          storage->ns_prefix_pattern = p_strdup(_storage->pool, wildcardp);
 72   
 73          have_username = FALSE;
 74          for (p = storage->ns_prefix_pattern; *p != '\0'; p++) {
 75                  if (*p != '%')
 76                          continue;
 77                  if (*++p == '\0')
 78                          break;
 79                  if (*p == 'u' || *p == 'n')
 80                          have_username = TRUE;
 81                  else if (*p != '%' && *p != 'd')
 82                          break;
 83          }
 84          if (*p != '\0') {
 85                  *error_r = "Shared namespace prefix contains unknown variables";
 86                  return -1;
 87          }
 88          if (!have_username) {
 89                  *error_r = "Shared namespace prefix doesn't contain %u or %n";
 90                  return -1;
 91          }
 92   
 93          /* truncate prefix after the above checks are done, so they can log
 94             the full prefix in error conditions */
 95          *wildcardp = '\0';
 96   
 97[+]         if (mailbox_list_alloc("shared", &_storage->list, error_r) < 0)
 98                  return -1;
 99          MODULE_CONTEXT_SET_FULL(_storage->list, shared_mailbox_list_module,
 100                                  storage, &storage->list_module_ctx);
 101   
 102          memset(&list_set, 0, sizeof(list_set));
 103          list_set.mail_storage_flags = &_storage->flags;
 104          list_set.lock_method = &_storage->lock_method;
 105          mailbox_list_init(_storage->list, _storage->ns, &list_set,
 106[+]                           mail_storage_get_list_flags(_storage->flags));
expand/collapse

mailbox_list_init

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/mailbox-list.c)expand/collapse
Show more  
 208  void mailbox_list_init(struct mailbox_list *list, struct mail_namespace *ns,
 209                         const struct mailbox_list_settings *set,
 210                         enum mailbox_list_flags flags)
 211  {
 212          i_assert(set->root_dir == NULL || *set->root_dir != '\0');
 213          i_assert(set->subscription_fname == NULL ||
 214                   *set->subscription_fname != '\0');
 215   
 216          list->ns = ns;
 217          list->flags = flags;
 218          list->file_create_mode = (mode_t)-1;
 219          list->dir_create_mode = (mode_t)-1;
 220          list->file_create_gid = (gid_t)-1;
 221   
 222          /* copy settings */
 223          list->set.root_dir = p_strdup(list->pool, set->root_dir);
 224          list->set.index_dir = set->index_dir == NULL ||
 225                  strcmp(set->index_dir, set->root_dir) == 0 ? NULL :
Show more  
Show more  




Change Warning 7514.24869 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: