[proftpd-dfsg] 01/01: Really revert commit 929b05c1cfa2257da24b47cf85bd191032b234f0. ; -(

Hilmar Preuße hilmar-guest at moszumanska.debian.org
Thu Sep 15 12:00:54 UTC 2016


This is an automated email from the git hooks/post-receive script.

hilmar-guest pushed a commit to branch master
in repository proftpd-dfsg.

commit 258bbd99167b712e1b2b8664ebf9610a393b9997
Author: Hilmar Preuße <hille42 at web.de>
Date:   Thu Sep 15 13:59:59 2016 +0200

    Really revert commit 929b05c1cfa2257da24b47cf85bd191032b234f0. ;-(
---
 contrib/mod_exec.c      | 17 +++++------------
 contrib/mod_sftp/keys.c | 12 +++---------
 contrib/mod_tls.c       | 12 +++---------
 debian/patches/series   |  1 +
 4 files changed, 12 insertions(+), 30 deletions(-)

diff --git a/contrib/mod_exec.c b/contrib/mod_exec.c
index fcaaf45..936655a 100644
--- a/contrib/mod_exec.c
+++ b/contrib/mod_exec.c
@@ -742,20 +742,14 @@ static int exec_ssystem(cmd_rec *cmd, config_rec *c, int flags) {
 
         if (fds >= 0) {
           int buflen;
-
-          size_t len = fpathconf(exec_stdout_pipe[0], _PC_PIPE_BUF);
-          char *buf = malloc(len);
-          if (buf == NULL) {
-            exec_log("malloc failed: %s", strerror(errno));
-            return errno;
-          }
+          char buf[PIPE_BUF];
 
           /* The child sent us something.  How thoughtful. */
 
           if (FD_ISSET(exec_stdout_pipe[0], &readfds)) {
-            memset(buf, '\0', len);
+            memset(buf, '\0', sizeof(buf));
 
-            buflen = read(exec_stdout_pipe[0], buf, len - 1);
+            buflen = read(exec_stdout_pipe[0], buf, sizeof(buf)-1);
             if (buflen > 0) {
               if (exec_opts & EXEC_OPT_SEND_STDOUT) {
 
@@ -802,9 +796,9 @@ static int exec_ssystem(cmd_rec *cmd, config_rec *c, int flags) {
           }
 
           if (FD_ISSET(exec_stderr_pipe[0], &readfds)) {
-            memset(buf, '\0', len);
+            memset(buf, '\0', sizeof(buf));
 
-            buflen = read(exec_stdout_pipe[0], buf, len - 1);
+            buflen = read(exec_stderr_pipe[0], buf, sizeof(buf)-1);
             if (buflen > 0) {
 
               /* Trim trailing CRs and LFs. */
@@ -834,7 +828,6 @@ static int exec_ssystem(cmd_rec *cmd, config_rec *c, int flags) {
               }
             }
           }
-          free(buf);
         }
 
         res = waitpid(pid, &status, WNOHANG);
diff --git a/contrib/mod_sftp/keys.c b/contrib/mod_sftp/keys.c
index 597efb8..1247ea6 100644
--- a/contrib/mod_sftp/keys.c
+++ b/contrib/mod_sftp/keys.c
@@ -413,15 +413,10 @@ static int exec_passphrase_provider(server_rec *s, char *buf, int buflen,
 
         if (FD_ISSET(stderr_pipe[0], &readfds)) {
           int stderrlen;
+          char stderrbuf[PIPE_BUF];
 
-          size_t len = fpathconf(stderr_pipe[0], _PC_PIPE_BUF);
-          char *stderrbuf = malloc(len);
-          if (stderrbuf == NULL) {
-            pr_log_pri(PR_LOG_ALERT, MOD_SFTP_VERSION ": Out of memory!");
-            return -1;
-	  }
-          memset(stderrbuf, '\0', len);
-          stderrlen = read(stderr_pipe[0], stderrbuf, len - 1);
+          memset(stderrbuf, '\0', sizeof(stderrbuf));
+          stderrlen = read(stderr_pipe[0], stderrbuf, sizeof(stderrbuf)-1);
           if (stderrlen > 0) {
             while (stderrlen &&
                    (stderrbuf[stderrlen-1] == '\r' ||
@@ -438,7 +433,6 @@ static int exec_passphrase_provider(server_rec *s, char *buf, int buflen,
               ": error reading stderr from '%s': %s",
               passphrase_provider, strerror(errno));
           }
-          free(stderrbuf);
         }
       }
 
diff --git a/contrib/mod_tls.c b/contrib/mod_tls.c
index b094517..df92658 100644
--- a/contrib/mod_tls.c
+++ b/contrib/mod_tls.c
@@ -1792,15 +1792,10 @@ static int tls_exec_passphrase_provider(server_rec *s, char *buf, int buflen,
 
         if (FD_ISSET(stderr_pipe[0], &readfds)) {
           int stderrlen;
+          char stderrbuf[PIPE_BUF];
 
-          size_t len = fpathconf(stderr_pipe[0], _PC_PIPE_BUF);
-          char *stderrbuf = malloc(len);
-          if (stderrbuf == NULL) {
-            tls_log("malloc failed: %s", strerror(errno));
-            return -1;
-          }
-          memset(stderrbuf, '\0', len);
-          stderrlen = read(stderr_pipe[0], stderrbuf, len - 1);
+          memset(stderrbuf, '\0', sizeof(stderrbuf));
+          stderrlen = read(stderr_pipe[0], stderrbuf, sizeof(stderrbuf)-1);
           if (stderrlen > 0) {
             while (stderrlen &&
                    (stderrbuf[stderrlen-1] == '\r' ||
@@ -1817,7 +1812,6 @@ static int tls_exec_passphrase_provider(server_rec *s, char *buf, int buflen,
               ": error reading stderr from '%s': %s",
               tls_passphrase_provider, strerror(errno));
           }
-          free(stderrbuf);
         }
       }
 
diff --git a/debian/patches/series b/debian/patches/series
index 9a3f646..5f78814 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,5 +11,6 @@ odbc
 silent
 use_hypen_in_manpage
 contrib_hardening_flags
+FTBS_on_Hurd
 large_files_SFTP.diff
 reproducible_build

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-proftpd/proftpd-dfsg.git



More information about the Pkg-proftpd-maintainers mailing list