Text   |  XML   |  ReML   |   Visible Warnings:

Buffer Overrun  at imap-quote.c:46

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

cmd_getquotaroot

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/imap-quota/imap-quota-plugin.c)expand/collapse
Show more  
 66  static bool cmd_getquotaroot(struct client_command_context *cmd)
 67  {
 68          struct client *client = cmd->client;
 69          struct mail_storage *storage;
 70          struct mail_namespace *ns;
 71          struct mailbox *box;
 72          struct quota_root_iter *iter;
 73          struct quota_root *root;
 74          const char *orig_mailbox, *mailbox, *name;
 75          string_t *str;
 76   
 77          /* <mailbox> */
 78[+]         if (!client_read_string_args(cmd, 1, &mailbox))
 79                  return FALSE;
 80   
 81          orig_mailbox = mailbox;
 82          storage = client_find_storage(cmd, &mailbox);
 83          if (storage == NULL)
 84                  return TRUE;
 85   
 86          box = mailbox_open(&storage, mailbox, NULL, (MAILBOX_OPEN_READONLY |
 87                                                       MAILBOX_OPEN_FAST |
 88[+]                                                      MAILBOX_OPEN_KEEP_RECENT));
 89          if (box == NULL) {
 90                  client_send_storage_error(cmd, storage);
 91                  return TRUE;
 92          }
 93   
 94          ns = mail_storage_get_namespace(storage);
 95          if (quota_set == NULL) {
 96                  mailbox_close(&box);
 97                  client_send_tagline(cmd, "OK No quota.");
 98                  return TRUE;
 99          }
 100          if (ns->owner != NULL && ns->owner != client->user &&
 101              !client->user->admin) {
 102                  mailbox_close(&box);
 103                  client_send_tagline(cmd, "NO Not showing other users' quota.");
 104                  return TRUE;
 105          }
 106   
 107          /* send QUOTAROOT reply */
 108          str = t_str_new(128);
 109          str_append(str, "* QUOTAROOT ");
 110          imap_quote_append_string(str, orig_mailbox, FALSE);
 111   
 112          iter = quota_root_iter_init(box);
 113[+]         while ((root = quota_root_iter_next(iter)) != NULL) {
 114                  str_append_c(str, ' ');
 115[+]                 name = imap_quota_root_get_name(client->user, ns->owner, root);
 116[+]                 imap_quote_append_string(str, name, FALSE);
expand/collapse

imap_quote_append

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-imap/imap-quote.c)expand/collapse
Show more  
 7  void imap_quote_append(string_t *str, const unsigned char *value,
 8                         size_t value_len, bool compress_lwsp)
 9  {
 10          size_t i, extra = 0;
 11          bool last_lwsp = TRUE, literal = FALSE, modify = FALSE;
 12   
 13          if (value == NULL) {
 14                  str_append(str, "NIL");
 15                  return;
 16          }
 17   
 18          if (value_len == (size_t)-1)
 19                  value_len = strlen((const char *) value);
 20   
 21          for (i = 0; i < value_len; i++) {
 22                  switch (value[i]) {
 23                  case 0:
 24                          /* it's converted to 8bit char */
 25                          literal = TRUE;
 26                          modify = TRUE;
 27                          last_lwsp = FALSE;
 28                          break;
 29                  case '\t':
 30                          modify = TRUE;
 31                          /* fall through */
 32                  case ' ':
 33                          if (last_lwsp && compress_lwsp) {
 34                                  modify = TRUE;
 35                                  extra++;
 36                          }
 37                          last_lwsp = TRUE;
 38                          break;
 39                  case 13:
 40                  case 10:
 41                          extra++;
 42                          modify = TRUE;
 43                          break;
 44                  default:
 45                          if ((value[i] & 0x80) != 0 ||
 46                              value[i] == '"' || value[i] == '\\')
 47                                  literal = TRUE;
 48                          last_lwsp = FALSE;
Show more  
Show more  




Change Warning 8139.24940 : Buffer Overrun

Because they are very similar, this warning shares annotations with warning 8139.24941.

Priority:
State:
Finding:
Owner:
Note: