Skip to content

Commit

Permalink
Merge pull request #8352 from douzzer/20240110-revert-8340
Browse files Browse the repository at this point in the history
20240110-revert-8340
  • Loading branch information
JacobBarthelmeh authored Jan 11, 2025
2 parents 99a6e82 + d4c6542 commit e037e08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
18 changes: 10 additions & 8 deletions src/quic.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,17 @@ static int quic_record_append(WOLFSSL *ssl, QuicRecord *qr, const uint8_t *data,
}
}

if (!quic_record_complete(qr) && len != 0) {
missing = qr->len - qr->end;
if (len > missing) {
len = missing;
}
XMEMCPY(qr->data + qr->end, data, len);
qr->end += (word32)len;
consumed += len;
if (quic_record_complete(qr) || len == 0) {
return 0;
}

missing = qr->len - qr->end;
if (len > missing) {
len = missing;
}
XMEMCPY(qr->data + qr->end, data, len);
qr->end += (word32)len;
consumed += len;

cleanup:
*pconsumed = (ret == WOLFSSL_SUCCESS) ? consumed : 0;
Expand Down
5 changes: 1 addition & 4 deletions tests/quic.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,7 @@ static int test_provide_quic_data(void) {
*/
AssertNotNull(ssl = wolfSSL_new(ctx));
len = fake_record(1, 100, lbuffer);
AssertTrue(provide_data(ssl, wolfssl_encryption_initial, lbuffer, 1, 0));
AssertTrue(provide_data(ssl, wolfssl_encryption_initial, lbuffer+1, 3, 0));
AssertTrue(provide_data(ssl, wolfssl_encryption_initial, lbuffer+4, len, 0)
);
AssertTrue(provide_data(ssl, wolfssl_encryption_initial, lbuffer, len, 0));
len = fake_record(2, 1523, lbuffer);
AssertTrue(provide_data(ssl, wolfssl_encryption_handshake, lbuffer, len, 0));
len = fake_record(2, 1, lbuffer);
Expand Down

0 comments on commit e037e08

Please sign in to comment.