gsasl-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gsasl branch, master, updated. gsasl-1-4-0-4-g709e130


From: Simon Josefsson
Subject: [SCM] GNU gsasl branch, master, updated. gsasl-1-4-0-4-g709e130
Date: Thu, 17 Dec 2009 08:10:15 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gsasl".

http://git.savannah.gnu.org/cgit/gsasl.git/commit/?id=709e13098601842979fe743c070cb1bd3d12b042

The branch, master has been updated
       via  709e13098601842979fe743c070cb1bd3d12b042 (commit)
      from  09618eb80bd9d14077611bac01b40d084a91fc4a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 709e13098601842979fe743c070cb1bd3d12b042
Author: Enrico Scholz <address@hidden>
Date:   Wed Oct 14 09:59:58 2009 +0200

    Improve application data throughput
    
    See <http://thread.gmane.org/gmane.comp.gnu.gsasl.general/256>.
    
    Signed-off-by: Simon Josefsson <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 src/gsasl.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/gsasl.c b/src/gsasl.c
index b65bd79..5bcbc18 100644
--- a/src/gsasl.c
+++ b/src/gsasl.c
@@ -30,6 +30,8 @@ bool using_tls = false;
 #endif
 
 #define MAX_LINE_LENGTH BUFSIZ
+#define INPUT_BUFSIZE  BUFSIZ
+#define MAX_INPUT_SIZE 0x100000
 
 struct gengetopt_args_info args_info;
 int sockfd = 0;
@@ -795,26 +797,31 @@ main (int argc, char *argv[])
                  ssize_t len;
                  char *tmp;
 
-                 tmp = realloc (sockbuf, sockpos + 1);
+                 tmp = realloc (sockbuf, sockpos + INPUT_BUFSIZE);
                  if (!tmp)
                    error (EXIT_FAILURE, errno, "realloc");
                  sockbuf = tmp;
 
 #ifdef HAVE_LIBGNUTLS
                  if (using_tls)
-                   len = gnutls_record_recv (session, &sockbuf[sockpos], 1);
+                   len = gnutls_record_recv (session, &sockbuf[sockpos],
+                                             INPUT_BUFSIZE);
                  else
 #endif
-                   len = recv (sockfd, &sockbuf[sockpos], 1, 0);
+                   len = recv (sockfd, &sockbuf[sockpos], INPUT_BUFSIZE, 0);
                  if (len <= 0)
                    break;
 
-                 sockpos++;
+                 sockpos += len;
 
                  res = gsasl_decode (xctx, sockbuf, sockpos,
                                      &out, &output_len);
-                 if (res == GSASL_NEEDS_MORE)
+                 if (res == GSASL_NEEDS_MORE) {
+                   if (sockpos > MAX_INPUT_SIZE)
+                     error (EXIT_FAILURE, 0,
+                            _("SASL record too large: %zu\n"), sockpos);
                    continue;
+                 }
                  if (res != GSASL_OK)
                    break;
 


hooks/post-receive
-- 
GNU gsasl




reply via email to

[Prev in Thread] Current Thread [Next in Thread]