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

create_login_process

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/master/login-process.c)expand/collapse
Show more  
 630  static pid_t (struct  *group)
 631  {
 632          struct log_io *log;
 633          const struct listener *listens;
 634          unsigned int max_log_lines_per_sec;
 635          const char *prefix;
 636          pid_t pid;
 637          ARRAY_TYPE(dup2) dups;
 638          unsigned int i, listen_count = 0, ssl_listen_count = 0;
 639          int fd[2], log_fd, cur_fd, tmp_fd;
 640   
 641          if (group->set-> == 0)
 642                  i_fatal(" process must not run as root");
 643   
 644          /* create communication to process with a socket pair */
 645          if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0) {
 646                  i_error("socketpair() failed: %m");
 647                  return -1;
 648          }
 649   
 650          max_log_lines_per_sec =
 651                  group->set-> ? 10 : 0;
 652          log_fd = log_create_pipe(&log, max_log_lines_per_sec);
 653          if (log_fd < 0)
 654                  pid = -1;
 655          else {
 656                  pid = fork();
 657                  if (pid < 0)
 658                          i_error("fork() failed: %m");
 659          }
 660   
 661          if (pid < 0) {
 662                  (void)close(fd[0]);
 663                  (void)close(fd[1]);
 664                  (void)close(log_fd);
 665                  return -1;
 666          }
 667   
 668          if (pid != 0) {
 669                  /* master */
 670                  prefix = t_strdup_printf("%s-: ",
 671                                  process_names[group->mail_process_type]);
 672                  log_set_prefix(log, prefix);
 673                  log_set_pid(log, pid);
 674   
 675                  net_set_nonblock(fd[0], TRUE);
 676                  fd_close_on_exec(fd[0], TRUE);
 677                  (void)(group, pid, fd[0], FALSE);
 678                  (void)close(fd[1]);
 679                  (void)close(log_fd);
 680                  return pid;
 681          }
 682   
 683          prefix = t_strdup_printf("master-%s-: ",
 684                                   process_names[group->mail_process_type]);
 685          log_set_prefix(log, prefix);
 686   
 687          t_array_init(&dups, 16);
 688          dup2_append(&dups, null_fd, STDIN_FILENO);
 689          /* redirect writes to stdout also to error log. For example OpenSSL 
 690             can be made to log its debug messages to stdout. */
 691          dup2_append(&dups, log_fd, STDOUT_FILENO);
 692          dup2_append(&dups, log_fd, STDERR_FILENO);
 693          dup2_append(&dups, fd[1], );
 694   
 695          /* redirect listener fds */
 696          cur_fd =  + 1;
 697[+]         if (array_is_created(&group->set->listens)) {
 698                  listens = array_get(&group->set->listens, &listen_count);
 699                  for (i = 0; i < listen_count; i++, cur_fd++)
 700                          dup2_append(&dups, listens[i].fd, cur_fd);
 701          }
 702   
 703          if (array_is_created(&group->set->ssl_listens)) {
 704                  listens = array_get(&group->set->ssl_listens,
 705[+]                                     &ssl_listen_count);
 706                  for (i = 0; i < ssl_listen_count; i++, cur_fd++)
 707                          dup2_append(&dups, listens[i].fd, cur_fd);
 708          }
 709   
 710          /* make sure we don't leak syslog fd. try to do it as late as possible,
 711             but also before dup2()s in case syslog fd is one of them. */
 712          closelog();
 713   
 714[+]         if (dup2_array(&dups) < 0)
 715                  i_fatal("Failed to dup2() fds");
 716   
 717          /* don't close any of these */
 718          for (tmp_fd = 0; tmp_fd < cur_fd; tmp_fd++)
 719                  fd_close_on_exec(tmp_fd, FALSE);
 720   
 721          (void)close(fd[0]);
 722          (void)close(fd[1]);
 723   
 724[+]         (group, getpid());
 725   
 726[+][+]         env_put(t_strdup_printf("LISTEN_FDS=%u", listen_count));
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 7758.25473 : Buffer Overrun

Priority:
State:
Finding:
Owner:
Note: