You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kg...@apache.org on 2014/03/17 16:21:30 UTC

svn commit: r1578432 - /qpid/proton/trunk/proton-c/src/ssl/openssl.c

Author: kgiusti
Date: Mon Mar 17 15:21:30 2014
New Revision: 1578432

URL: http://svn.apache.org/r1578432
Log:
PROTON-537: fix dangling pointer in SSL layer.

Modified:
    qpid/proton/trunk/proton-c/src/ssl/openssl.c

Modified: qpid/proton/trunk/proton-c/src/ssl/openssl.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/ssl/openssl.c?rev=1578432&r1=1578431&r2=1578432&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/ssl/openssl.c (original)
+++ qpid/proton/trunk/proton-c/src/ssl/openssl.c Mon Mar 17 15:21:30 2014
@@ -877,13 +877,13 @@ static ssize_t process_input_ssl( pn_io_
     // write incoming data to app layer
 
     if (!ssl->app_input_closed) {
-      char *data = ssl->inbuf;
       if (ssl->in_count > 0 || ssl->ssl_closed) {  /* if ssl_closed, send 0 count */
         pn_io_layer_t *io_next = ssl->io_layer->next;
-        ssize_t consumed = io_next->process_input( io_next, data, ssl->in_count);
+        ssize_t consumed = io_next->process_input( io_next, ssl->inbuf, ssl->in_count);
         if (consumed > 0) {
           ssl->in_count -= consumed;
-          data += consumed;
+          if (ssl->in_count)
+            memmove( ssl->inbuf, ssl->inbuf + consumed, ssl->in_count );
           work_pending = true;
           _log( ssl, "Application consumed %d bytes from peer\n", (int) consumed );
         } else if (consumed < 0) {
@@ -923,8 +923,6 @@ static ssize_t process_input_ssl( pn_io_
           }
         }
       }
-      if (ssl->in_count > 0 && data != ssl->inbuf)
-        memmove( ssl->inbuf, data, ssl->in_count );
     }
 
   } while (work_pending);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org