Text   |  XML   |  ReML   |   Visible Warnings:

Null Pointer Dereference  at main.c:484

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

main

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/login-common/main.c)expand/collapse
Show more  
 397  int main(int argc ATTR_UNUSED, char *argv[], char *envp[])
 398  {
 399          const char *group_name;
 400          struct ip_addr remote_ip, local_ip;
 401          unsigned int remote_port, local_port, max_fds;
 402          struct ssl_proxy *proxy = NULL;
 403          struct client *client;
 404          int i, fd = -1, master_fd = -1;
 405          bool ssl = FALSE;
 406   
 407          is_inetd = getenv("DOVECOT_MASTER") == NULL;
 408   
 409  #ifdef DEBUG 
 410          if (!is_inetd && getenv("GDB") == NULL) {
 411                  const char *env;
 412   
 413                  i =  + 1;
 414                  env = getenv("LISTEN_FDS");
 415                  if (env != NULL) i += atoi(env);
 416                  env = getenv("SSL_LISTEN_FDS");
 417                  if (env != NULL) i += atoi(env);
 418   
 419                  fd_debug_verify_leaks(i, 1024);
 420          }
 421  #endif
 422          /* NOTE: we start rooted, so keep the code minimal until
 423             restrict_access_by_env() is called */
 424          lib_init();
 425   
 426          if (is_inetd) {
 427                  /* running from inetd. create master process before
 428                     dropping privileges. */
 429                  process_name = strrchr(argv[0], '/');
 430                  process_name = process_name == NULL ? argv[0] : process_name+1;
 431                  group_name = t_strcut(process_name, '-');
 432   
 433                  for (i = 1; i < argc; i++) {
 434                          if (strncmp(argv[i], "--group=", 8) == 0) {
 435                                  group_name = argv[1]+8;
 436                                  break;
 437                          }
 438                  }
 439   
 440                  master_fd = master_connect(group_name);
 441          }
 442   
 443          drop_privileges(&max_fds);
 444   
 445          if (argv[1] != NULL && strcmp(argv[1], "-D") == 0)
 446                  restrict_access_allow_coredumps(TRUE);
 447   
 448          process_title_init(argv, envp);
 449          ioloop = io_loop_create();
 450          io_loop_set_max_fd_count(ioloop, max_fds);
 451          main_init();
 452   
 453          if (is_inetd) {
 454[+]                 if (net_getpeername(1, &remote_ip, &remote_port) < 0) {
 455                          i_fatal("%s can be started only through dovecot "
 456                                  "master process, inetd or equivalent", argv[0]);
 457                  }
 458[+]                 if (net_getsockname(1, &local_ip, &local_port) < 0) {
 459                          memset(&local_ip, 0, sizeof(local_ip));
 460                          local_port = 0;
 461                  }
 462   
 463                  fd = 1;
 464                  for (i = 1; i < argc; i++) {
 465                          if (strcmp(argv[i], "--ssl") == 0)
 466                                  ssl = TRUE;
 467                          else if (strncmp(argv[i], "--group=", 8) != 0)
 468                                  i_fatal("Unknown parameter: %s", argv[i]);
 469                  }
 470   
 471                  /* hardcoded imaps and pop3s ports to be SSL by default */
 472                  if (local_port == 993 || local_port == 995 || ssl) {
 473                          ssl = TRUE;
 474                          fd = ssl_proxy_new(fd, &remote_ip, &proxy);
 475                          if (fd == -1)
 476                                  return 1;
 477                  }
 478   
 479                  master_init(master_fd);
 480                  closing_down = TRUE;
 481   
 482                  if (fd != -1) {
 483[+]                         client = client_create(fd, ssl, &local_ip, &remote_ip);
 484                          client->proxy = proxy;
Show more  




Change Warning 12159.25831 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: