From 0ea4fa0f97ab9a3d521888ce451838055574c8f8 Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 18 May 2026 13:53:07 -0700 Subject: [PATCH] fix(qat): fenrir 586 guard exit memcpy on error path --- wolfcrypt/src/port/intel/quickassist_sync.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/src/port/intel/quickassist_sync.c b/wolfcrypt/src/port/intel/quickassist_sync.c index cd12c63493..a020677ba9 100644 --- a/wolfcrypt/src/port/intel/quickassist_sync.c +++ b/wolfcrypt/src/port/intel/quickassist_sync.c @@ -1100,9 +1100,12 @@ exit: } /* Capture the inline decrypt into the output. */ - XMEMCPY(out, dataBuf, inOutSz); - if (cipherDirection == CPA_CY_SYM_CIPHER_DIRECTION_ENCRYPT) { - if (authTag != NULL && authTagSz > 0) { + if (ret == 0 && dataBuf != NULL) { + XMEMCPY(out, dataBuf, inOutSz); + } + if (ret == 0 && + cipherDirection == CPA_CY_SYM_CIPHER_DIRECTION_ENCRYPT) { + if (authTag != NULL && authTagSz > 0 && authTagBuf != NULL) { XMEMCPY(authTag, authTagBuf, authTagSz); } }