Fix memcpy-less DTLS RX so it really doesn't use memcpy().
authorDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 14 Dec 2011 15:41:35 +0000 (15:41 +0000)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 14 Dec 2011 15:41:35 +0000 (15:41 +0000)
It was receiving into a preallocated packet... then using queue_new_packet()
on that buffer which would allocate and copy to a *new* packet. Doh!

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
dtls.c

diff --git a/dtls.c b/dtls.c
index 909e7a5..86842f8 100644 (file)
--- a/dtls.c
+++ b/dtls.c
@@ -462,7 +462,9 @@ int dtls_mainloop(struct openconnect_info *vpninfo, int *timeout)
 
                switch(buf[0]) {
                case AC_PKT_DATA:
-                       queue_new_packet(&vpninfo->incoming_queue, buf+1, len-1);
+                       dtls_pkt->len = len - 1;
+                       queue_packet(&vpninfo->incoming_queue, dtls_pkt);
+                       dtls_pkt = NULL;
                        work_done = 1;
                        break;