Commit ba7d93db authored by Nick Mathewson's avatar Nick Mathewson 🥔
Browse files

Merge remote-tracking branch 'public/bug7816_023'

Conflicts:
	src/common/util.c
parents 0061d428 d3aabf4d
Loading
Loading
Loading
Loading

changes/bug7816_023

0 → 100644
+7 −0
Original line number Diff line number Diff line
  o Minor bugfixes (memory leak, controller):
    - Fix a memory leak during safe-cookie controller authentication.
      Spotted by Coverity. Fixes part of bug 7816; bugfix on 0.2.3.13-alpha.

  o Minor bugfixes (memory leak, HTTPS proxy support):
    - Fix a memory leak when receiving headers from an HTTPS proxy.
      Spotted by Coverity. Fixes part of bug 7816; bugfix on 0.2.1.1-alpha.
+3 −0
Original line number Diff line number Diff line
  o Minor bugfixes:
    - Fix various places where we leak file descriptors or memory on
      error cases. Spotted by coverity. Fixes parts of bug 7816.
+3 −1
Original line number Diff line number Diff line
@@ -833,8 +833,10 @@ add_file_log(const log_severity_list_t *severity, const char *filename)
  fd = tor_open_cloexec(filename, O_WRONLY|O_CREAT|O_APPEND, 0644);
  if (fd<0)
    return -1;
  if (tor_fd_seekend(fd)<0)
  if (tor_fd_seekend(fd)<0) {
    close(fd);
    return -1;
  }

  LOCK_LOGS();
  add_stream_log_impl(severity, filename, fd);
+3 −1
Original line number Diff line number Diff line
@@ -2374,8 +2374,10 @@ read_file_to_str(const char *filename, int flags, struct stat *stat_out)
  }
#endif

  if ((uint64_t)(statbuf.st_size)+1 >= SIZE_T_CEILING)
  if ((uint64_t)(statbuf.st_size)+1 >= SIZE_T_CEILING) {
    close(fd);
    return NULL;
  }

  string = tor_malloc((size_t)(statbuf.st_size+1));

+4 −0
Original line number Diff line number Diff line
@@ -1058,6 +1058,7 @@ connection_listener_new(const struct sockaddr *listensockaddr,
    if (bind(s, listensockaddr, (socklen_t)sizeof(struct sockaddr_un)) == -1) {
      log_warn(LD_NET,"Bind to %s failed: %s.", address,
               tor_socket_strerror(tor_socket_errno(s)));
      tor_close_socket(s);
      goto err;
    }
#ifdef HAVE_PWD_H
@@ -1066,9 +1067,11 @@ connection_listener_new(const struct sockaddr *listensockaddr,
      if (pw == NULL) {
        log_warn(LD_NET,"Unable to chown() %s socket: user %s not found.",
                 address, options->User);
        tor_close_socket(s);
      } else if (chown(address, pw->pw_uid, pw->pw_gid) < 0) {
        log_warn(LD_NET,"Unable to chown() %s socket: %s.",
                 address, strerror(errno));
        tor_close_socket(s);
        goto err;
      }
    }
@@ -1707,6 +1710,7 @@ connection_read_https_proxy_response(connection_t *conn)
    tor_free(headers);
    return -1;
  }
  tor_free(headers);
  if (!reason) reason = tor_strdup("[no reason given]");

  if (status_code == 200) {
Loading