"It cannot be NULL", but since this is self-test infrastructure, assume
the worst - add ASSERT() check to ensure assumptions are true.

Found by Coverity.

Signed-off-by: Gert Doering <[email protected]>
---
 src/openvpn/crypto.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index 6e1e46b..41dae92 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -1028,6 +1028,7 @@ test_crypto (struct crypto_options *co, struct frame* 
frame)
   struct buffer encrypt_workspace = alloc_buf_gc (BUF_SIZE (frame), &gc);
   struct buffer decrypt_workspace = alloc_buf_gc (BUF_SIZE (frame), &gc);
   struct buffer buf = clear_buf();
+  void * buf_p;
 
   /* init work */
   ASSERT (buf_init (&work, FRAME_HEADROOM (frame)));
@@ -1073,7 +1074,9 @@ test_crypto (struct crypto_options *co, struct frame* 
frame)
 
       /* copy source to input buf */
       buf = work;
-      memcpy (buf_write_alloc (&buf, BLEN (&src)), BPTR (&src), BLEN (&src));
+      buf_p = buf_write_alloc (&buf, BLEN (&src));
+      ASSERT(buf_p);
+      memcpy (buf_p, BPTR (&src), BLEN (&src));
 
       /* initialize work buffer with FRAME_HEADROOM bytes of prepend capacity 
*/
       ASSERT (buf_init (&encrypt_workspace, FRAME_HEADROOM (frame)));
-- 
2.7.3


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to