Text   |  XML   |  ReML   |   Visible Warnings:

Buffer Overrun  at var-expand.c:304

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

env_put_namespace

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/master/mail-process.c)expand/collapse
Show more  
 248  env_put_namespace(struct namespace_settings *ns, const char *default_location,
 249                    const struct var_expand_table *table)
 250  {
 251          const char *location;
 252          unsigned int i;
 253          string_t *str;
 254   
 255          if (default_location == NULL)
 256                  default_location = "";
 257   
 258          for (i = 1; ns != NULL; i++, ns = ns->next) {
 259                  location = *ns->location != '\0' ? ns->location :
 260                          default_location;
 261[+]                 location = expand_mail_env(location, table);
expand/collapse

expand_mail_env

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/master/mail-process.c)expand/collapse
Show more  
 218  static const char *
 219  expand_mail_env(const char *env, const struct var_expand_table *table)
 220  {
 221          string_t *str;
 222          const char *p;
 223   
 224          str = t_str_new(256);
 225   
 226          /* it's either type:data or just data */
 227          p = strchr(env, ':');
 228          if (p != NULL) {
 229                  while (env != p) {
 230                          str_append_c(str, *env);
 231                          env++;
 232                  }
 233   
 234                  str_append_c(str, *env++);
 235          }
 236   
 237[+]         if (has_missing_used_home(env, table)) {
expand/collapse

has_missing_used_home

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/master/mail-process.c)expand/collapse
Show more  
 210  has_missing_used_home(const char *str, const struct var_expand_table *table)
 211  {
 212          i_assert(table[VAR_EXPAND_HOME_IDX].key == 'h');
 213   
 214          return table[VAR_EXPAND_HOME_IDX].value == NULL &&
 215[+]                 var_has_key(str, 'h', "home");
expand/collapse

var_has_key

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/var-expand.c)expand/collapse
Show more  
 307  bool var_has_key(const char *str, char key, const char *long_key)
 308  {
 309          const char *end;
 310          char c;
 311   
 312          for (; *str != '\0'; str++) {
 313                  if (*str == '%' && str[1] != '\0') {
 314                          str++;
 315[+]                         c = var_get_key(str);
expand/collapse

var_get_key

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/var-expand.c)expand/collapse
Show more  
 281  char var_get_key(const char *str)
 282  {
 283          const struct var_expand_modifier *m;
 284   
 285          /* [<offset>.]<width>[<modifiers>]<variable> */
 286          while ((*str >= '0' && *str <= '9') || *str == '-')
 287                  str++;
 288   
 289          if (*str == '.') {
 290                  str++;
 291                  while (*str >= '0' && *str <= '9')
 292                          str++;
 293          }
 294   
 295          do {
 296                  for (m = modifiers; m->key != '\0'; m++) {
 297                          if (m->key == *str) {
 298                                  str++;
 299                                  break;
 300                          }
 301                  }
 302          } while (m->key != '\0');
 303   
 304          return *str;
Show more  
Show more  
Show more  
Show more  
 262                  env_put(t_strdup_printf("NAMESPACE_%u=%s", i, location));
 263   
 264                  if (ns->separator != NULL) {
 265                          env_put(t_strdup_printf("NAMESPACE_%u_SEP=%s",
 266                                                  i, ns->separator));
 267                  }
 268                  if (ns->type != NULL) {
 269                          env_put(t_strdup_printf("NAMESPACE_%u_TYPE=%s",
 270                                                  i, ns->type));
 271                  }
 272                  if (ns->alias_for != NULL) {
 273                          env_put(t_strdup_printf("NAMESPACE_%u_ALIAS=%s",
 274                                                  i, ns->alias_for));
 275                  }
 276                  if (ns->prefix != NULL) {
 277                          /* expand variables, eg. ~%u/ can be useful */
 278                          str = t_str_new(256);
 279                          str_printfa(str, "NAMESPACE_%u_PREFIX=", i);
 280                          var_expand(str, ns->prefix, table);
 281                          env_put(str_c(str));
 282                  }
 283                  if (ns->inbox)
 284                          env_put(t_strdup_printf("NAMESPACE_%u_INBOX=1", i));
 285                  if (ns->hidden)
 286                          env_put(t_strdup_printf("NAMESPACE_%u_HIDDEN=1", i));
 287                  if (strcmp(ns->list, "no") != 0) {
 288                          env_put(t_strdup_printf("NAMESPACE_%u_LIST=%s",
 289                                                  i, ns->list));
 290                  }
 291                  if (ns->subscriptions)
 292                          env_put(t_strdup_printf("NAMESPACE_%u_SUBSCRIPTIONS=1",
 293                                                  i));
Show more  




Change Warning 7732.24774 : Buffer Overrun

Priority:
State:
Finding:
Owner:
Note: