Text   |  XML   |  ReML   |   Visible Warnings:

Buffer Overrun  at strfuncs.c:39

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

config_file_init

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/deliver/deliver.c)expand/collapse
Show more  
 327  static void config_file_init(const char *path)
 328  {
 329          struct istream *input;
 330          const char *key, *value, *str, *ukey;
 331          char *line, *p, quote;
 332          int fd, sections = 0;
 333          bool lda_section = FALSE, pop3_section = FALSE, plugin_section = FALSE;
 334          bool ns_section = FALSE, ns_location = FALSE, ns_list = FALSE;
 335          bool ns_subscriptions = FALSE;
 336          unsigned int i, ns_idx = 0;
 337          size_t len;
 338   
 339          plugin_pool = pool_alloconly_create("Plugin strings", 512);
 340          i_array_init(&lda_envs, 16);
 341          i_array_init(&plugin_envs, 16);
 342   
 343          fd = open(path, O_RDONLY);
 344          if (fd < 0)
 345                  i_fatal_status(EX_CONFIG, "open(%s) failed: %m", path);
 346   
 347          input = i_stream_create_fd(fd, 1024, TRUE);
 348          i_stream_set_return_partial_line(input, TRUE);
 349[+]         while ((line = i_stream_read_next_line(input)) != NULL) {
 350                  /* @UNSAFE: line is modified */
 351   
 352                  /* skip whitespace */
 353                  while (IS_WHITE(*line))
 354                          line++;
 355   
 356                  /* ignore comments or empty lines */
 357                  if (*line == '#' || *line == '\0')
 358                          continue;
 359   
 360                  /* strip away comments. pretty kludgy way really.. */
 361                  for (p = line; *p != '\0'; p++) {
 362                          if (*p == '\'' || *p == '"') {
 363                                  quote = *p;
 364                                  for (p++; *p != quote && *p != '\0'; p++) {
 365                                          if (*p == '\\' && p[1] != '\0')
 366                                                  p++;
 367                                  }
 368                                  if (*p == '\0')
 369                                          break;
 370                          } else if (*p == '#') {
 371                                  *p = '\0';
 372                                  break;
 373                          }
 374                  }
 375   
 376                  /* remove whitespace from end of line */
 377                  len = strlen(line);
 378                  while (IS_WHITE(line[len-1]))
 379                          len--;
 380                  line[len] = '\0';
 381   
 382                  if (strncmp(line, "!include_try ", 13) == 0)
 383                          continue;
 384                  if (strncmp(line, "!include ", 9) == 0) {
 385                          i_fatal_status(EX_CONFIG, "Error in config file %s: "
 386                                         "deliver doesn't support !include directive", path);
 387                  }
 388   
 389                  value = p = strchr(line, '=');
 390                  if (value == NULL) {
 391                          if (strchr(line, '{') != NULL) {
 392                                  if (strcmp(line, "protocol lda {") == 0)
 393                                          lda_section = TRUE;
 394                                  else if (strcmp(line, "plugin {") == 0)
 395                                          plugin_section = TRUE;
 396                                  else if (strcmp(line, "protocol pop3 {") == 0)
 397                                          pop3_section = TRUE;
 398                                  else if (strncmp(line, "namespace ", 10) == 0) {
 399                                          ns_section = TRUE;
 400                                          ns_idx++;
 401                                          line += 10;
 402                                          env_put(t_strdup_printf(
 403                                                  "NAMESPACE_%u_TYPE=%s", ns_idx,
 404[+][+]                                                 t_strcut(line, ' ')));
expand/collapse

env_put

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/env-util.c)expand/collapse
Show more  
 15  void env_put(const char *env)
 16  {
 17          if (env_pool == NULL) {
 18                  env_pool = pool_alloconly_create(MEMPOOL_GROWING"Environment",
 19                                                   2048);
 20          }
 21[+]         if (putenv(p_strdup(env_pool, env)) != 0)
expand/collapse

p_strdup

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/strfuncs.c)expand/collapse
Show more  
 31  char *p_strdup(pool_t pool, const char *str)
 32  {
 33          void *mem;
 34          size_t len;
 35   
 36          if (str == NULL)
 37                  return NULL;
 38   
 39          for (len = 0; (str)[len] != '\0'; )
 40                  len++;
Show more  
Show more  
Show more  




Change Warning 8006.24810 : Buffer Overrun

Priority:
State:
Finding:
Owner:
Note: