[git] Assuan - branch, master, updated. libassuan-2.2.1-8-g5a52404

by Werner Koch cvs at cvs.gnupg.org
Fri Aug 28 10:26:49 CEST 2015


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 "IPC library used by GnuPG".

The branch, master has been updated
       via  5a52404c704d0e99629a2db79dda17e3b95c9680 (commit)
      from  d4bef26a49879761867ad6d57113341915db6acf (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 5a52404c704d0e99629a2db79dda17e3b95c9680
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Aug 28 10:22:39 2015 +0200

    Read up remaining lines in assuan_inquire after reaching MAXLEN
    
    * src/assuan-inquire.c (assuan_inquire): Clear return args on error.
    Read up remaining lines after MAXLEN has been hit.
    --
    
    If we would stop immediately at MAXLEN, as we did, the client would
    continue to send data which the server may consider as new Assuan
    commands.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/doc/assuan.texi b/doc/assuan.texi
index 1c3c2ca..14f2cf0 100644
--- a/doc/assuan.texi
+++ b/doc/assuan.texi
@@ -1763,8 +1763,8 @@ the required data (@var{keyword}).  All other parameters may be
 
 On success the result is stored in a newly allocated buffer stored at
 @var{r_buffer}. The length of the data is stored at @var{r_length}.
-If @var{maxlen} has not been given as @code{0}, it describes an upper
-size limited of the expected data.  If the client returns too much
+If @var{maxlen} has not been given as @code{0}, it specifies an upper
+size limit of the expected data.  If the client returns too much
 data the function fails and an error with the error code
 @code{GPG_ERR_ASS_TOO_MUCH_DATA} will be returned.
 @end deftypefun
diff --git a/src/assuan-inquire.c b/src/assuan-inquire.c
index a4cfc20..f863935 100644
--- a/src/assuan-inquire.c
+++ b/src/assuan-inquire.c
@@ -136,7 +136,7 @@ free_membuf (assuan_context_t ctx, struct membuf *mb)
  * A server may use this to send an inquire.  r_buffer, r_length and
  * maxlen may all be NULL/0 to indicate that no real data is expected.
  * The returned buffer is guaranteed to have an extra 0-byte after the
- * length.  Thus it can be used as a string if embedded o bytes are
+ * length.  Thus it can be used as a string if embedded 0 bytes are
  * not an issue.
  *
  * Return value: 0 on success or an ASSUAN error code
@@ -152,6 +152,11 @@ assuan_inquire (assuan_context_t ctx, const char *keyword,
   int linelen;
   int nodataexpected;
 
+  if (r_buffer)
+    *r_buffer = NULL;
+  if (r_length)
+    *r_length = 0;
+
   if (!ctx || !keyword || (10 + strlen (keyword) >= sizeof (cmdbuf)))
     return _assuan_error (ctx, GPG_ERR_ASS_INV_VALUE);
   nodataexpected = !r_buffer && !r_length && !maxlen;
@@ -212,6 +217,9 @@ assuan_inquire (assuan_context_t ctx, const char *keyword,
       line += 2;
       linelen -= 2;
 
+      if (mb.too_large)
+        continue; /* Need to read up the remaining data.  */
+
       p = line;
       while (linelen)
         {
@@ -229,18 +237,18 @@ assuan_inquire (assuan_context_t ctx, const char *keyword,
             }
           line = p;
         }
-      if (mb.too_large)
-        {
-          rc = _assuan_error (ctx, GPG_ERR_ASS_TOO_MUCH_DATA);
-          goto out;
-        }
     }
 
   if (!nodataexpected)
     {
-      *r_buffer = get_membuf (ctx, &mb, r_length);
-      if (!*r_buffer)
-	rc = _assuan_error (ctx, gpg_err_code_from_syserror ());
+      if (mb.too_large)
+        rc = _assuan_error (ctx, GPG_ERR_ASS_TOO_MUCH_DATA);
+      else
+        {
+          *r_buffer = get_membuf (ctx, &mb, r_length);
+          if (!*r_buffer)
+            rc = _assuan_error (ctx, gpg_err_code_from_syserror ());
+        }
     }
 
  out:

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

Summary of changes:
 doc/assuan.texi      |  4 ++--
 src/assuan-inquire.c | 26 +++++++++++++++++---------
 2 files changed, 19 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
IPC library used by GnuPG
http://git.gnupg.org




More information about the Gnupg-commits mailing list