Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -9834,7 +9834,7 @@ int DtlsMsgSet(DtlsMsg* msg, word32 seq, word16 epoch, const byte* data, byte ty
done = 1;
break;
}
else if (fragOffset <= curEnd) {
else if (fragOffset <= curEnd && fragOffsetEnd >= cur->m.m.offset) {
/* found place to store fragment */
break;
}
Expand Down
32 changes: 32 additions & 0 deletions src/ssl_sess.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,22 @@ int wolfSSL_memrestore_session_cache(const void* mem, int sz)
#endif

XMEMCPY(&SessionCache[i], row++, SIZEOF_SESSION_ROW);
#ifndef SESSION_CACHE_DYNAMIC_MEM
/* Reset pointers to safe values after raw copy */
{
int j;
for (j = 0; j < SESSIONS_PER_ROW; j++) {
WOLFSSL_SESSION* s = &SessionCache[i].Sessions[j];
#ifdef HAVE_SESSION_TICKET
s->ticket = s->staticTicket;
s->ticketLenAlloc = 0;
#endif
#if defined(SESSION_CERTS) && defined(OPENSSL_EXTRA)
s->peer = NULL;
#endif
}
}
#endif
#ifdef ENABLE_SESSION_CACHE_ROW_LOCK
SESSION_ROW_UNLOCK(&SessionCache[i]);
#endif
Expand Down Expand Up @@ -681,6 +697,22 @@ int wolfSSL_restore_session_cache(const char *fname)
#endif

ret = (int)XFREAD(&SessionCache[i], SIZEOF_SESSION_ROW, 1, file);
#ifndef SESSION_CACHE_DYNAMIC_MEM
/* Reset pointers to safe values after raw copy */
{
int j;
for (j = 0; j < SESSIONS_PER_ROW; j++) {
WOLFSSL_SESSION* s = &SessionCache[i].Sessions[j];
#ifdef HAVE_SESSION_TICKET
s->ticket = s->staticTicket;
s->ticketLenAlloc = 0;
#endif
#if defined(SESSION_CERTS) && defined(OPENSSL_EXTRA)
s->peer = NULL;
#endif
}
}
#endif
#ifdef ENABLE_SESSION_CACHE_ROW_LOCK
SESSION_ROW_UNLOCK(&SessionCache[i]);
#endif
Expand Down
4 changes: 4 additions & 0 deletions src/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -9937,6 +9937,10 @@ static int TLSX_KeyShare_ProcessPqcClient_ex(WOLFSSL* ssl,
}
#endif

if (ret == 0 && keyShareEntry->keLen < ctSz) {
WOLFSSL_MSG("PQC key share data too short for ciphertext.");
ret = BUFFER_E;
}
if (ret == 0) {
ret = wc_KyberKey_Decapsulate(kem, ssOutput,
keyShareEntry->ke, ctSz);
Expand Down
Loading
Loading