summaryrefslogtreecommitdiffstats
path: root/test/helpers/quictestlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/helpers/quictestlib.c')
-rw-r--r--test/helpers/quictestlib.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/test/helpers/quictestlib.c b/test/helpers/quictestlib.c
index 26cd67e236..2c74b26252 100644
--- a/test/helpers/quictestlib.c
+++ b/test/helpers/quictestlib.c
@@ -929,12 +929,14 @@ int qtest_fault_resize_message(QTEST_FAULT *fault, size_t newlen)
int qtest_fault_delete_extension(QTEST_FAULT *fault,
unsigned int exttype, unsigned char *ext,
- size_t *extlen)
+ size_t *extlen,
+ BUF_MEM *old_ext)
{
PACKET pkt, sub, subext;
+ WPACKET old_ext_wpkt;
unsigned int type;
const unsigned char *start, *end;
- size_t newlen;
+ size_t newlen, w;
size_t msglen = fault->handbuflen;
if (!PACKET_buf_init(&pkt, ext, *extlen))
@@ -954,6 +956,21 @@ int qtest_fault_delete_extension(QTEST_FAULT *fault,
/* Found it */
end = PACKET_data(&sub);
+ if (old_ext != NULL) {
+ if (!WPACKET_init(&old_ext_wpkt, old_ext))
+ return 0;
+
+ if (!WPACKET_memcpy(&old_ext_wpkt, PACKET_data(&subext),
+ PACKET_remaining(&subext))
+ || !WPACKET_get_total_written(&old_ext_wpkt, &w)) {
+ WPACKET_cleanup(&old_ext_wpkt);
+ return 0;
+ }
+
+ WPACKET_finish(&old_ext_wpkt);
+ old_ext->length = w;
+ }
+
/*
* If we're not the last extension we need to move the rest earlier. The
* cast below is safe because we own the underlying buffer and we're no