2 * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
11 #include <openssl/configuration.h>
12 #include <openssl/bio.h>
13 #include "quictestlib.h"
14 #include "ssltestlib.h"
15 #include "../testutil.h"
16 #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
17 # include "../threadstest.h"
19 #include "internal/quic_wire_pkt.h"
20 #include "internal/quic_record_tx.h"
21 #include "internal/quic_error.h"
22 #include "internal/packet.h"
24 #define GROWTH_ALLOWANCE 1024
29 /* Plain packet mutations */
30 /* Header for the plaintext packet */
31 QUIC_PKT_HDR pplainhdr
;
32 /* iovec for the plaintext packet data buffer */
33 OSSL_QTX_IOVEC pplainio
;
34 /* Allocated size of the plaintext packet data buffer */
35 size_t pplainbuf_alloc
;
36 qtest_fault_on_packet_plain_cb pplaincb
;
39 /* Handshake message mutations */
40 /* Handshake message buffer */
41 unsigned char *handbuf
;
42 /* Allocated size of the handshake message buffer */
44 /* Actual length of the handshake message */
46 qtest_fault_on_handshake_cb handshakecb
;
48 qtest_fault_on_enc_ext_cb encextcb
;
51 /* Cipher packet mutations */
52 qtest_fault_on_packet_cipher_cb pciphercb
;
55 /* Datagram mutations */
56 qtest_fault_on_datagram_cb datagramcb
;
58 /* The currently processed message */
60 /* Allocated size of msg data buffer */
64 static void packet_plain_finish(void *arg
);
65 static void handshake_finish(void *arg
);
67 static BIO_METHOD
*get_bio_method(void);
69 static OSSL_TIME fake_now
;
71 static OSSL_TIME
fake_now_cb(void *arg
)
76 int qtest_create_quic_objects(OSSL_LIB_CTX
*libctx
, SSL_CTX
*clientctx
,
77 char *certfile
, char *keyfile
,
78 int flags
, QUIC_TSERVER
**qtserv
, SSL
**cssl
,
81 /* ALPN value as recognised by QUIC_TSERVER */
82 unsigned char alpn
[] = { 8, 'o', 's', 's', 'l', 't', 'e', 's', 't' };
83 QUIC_TSERVER_ARGS tserver_args
= {0};
84 BIO
*cbio
= NULL
, *sbio
= NULL
, *fisbio
= NULL
;
85 BIO_ADDR
*peeraddr
= NULL
;
86 struct in_addr ina
= {0};
93 *cssl
= SSL_new(clientctx
);
98 /* SSL_set_alpn_protos returns 0 for success! */
99 if (!TEST_false(SSL_set_alpn_protos(*cssl
, alpn
, sizeof(alpn
))))
102 if (!TEST_ptr(peeraddr
= BIO_ADDR_new()))
105 if ((flags
& QTEST_FLAG_BLOCK
) != 0) {
106 #if !defined(OPENSSL_NO_POSIX_IO)
110 * For blocking mode we need to create actual sockets rather than doing
111 * everything in memory
113 if (!TEST_true(create_test_sockets(&cfd
, &sfd
, SOCK_DGRAM
, peeraddr
)))
115 cbio
= BIO_new_dgram(cfd
, 1);
116 if (!TEST_ptr(cbio
)) {
121 sbio
= BIO_new_dgram(sfd
, 1);
122 if (!TEST_ptr(sbio
)) {
130 if (!TEST_true(BIO_new_bio_dgram_pair(&cbio
, 0, &sbio
, 0)))
133 if (!TEST_true(BIO_dgram_set_caps(cbio
, BIO_DGRAM_CAP_HANDLES_DST_ADDR
))
134 || !TEST_true(BIO_dgram_set_caps(sbio
, BIO_DGRAM_CAP_HANDLES_DST_ADDR
)))
137 /* Dummy server address */
138 if (!TEST_true(BIO_ADDR_rawmake(peeraddr
, AF_INET
, &ina
, sizeof(ina
),
143 SSL_set_bio(*cssl
, cbio
, cbio
);
145 if (!TEST_true(SSL_set_blocking_mode(*cssl
,
146 (flags
& QTEST_FLAG_BLOCK
) != 0 ? 1 : 0)))
149 if (!TEST_true(SSL_set_initial_peer_addr(*cssl
, peeraddr
)))
153 *fault
= OPENSSL_zalloc(sizeof(**fault
));
158 fisbio
= BIO_new(get_bio_method());
159 if (!TEST_ptr(fisbio
))
162 BIO_set_data(fisbio
, fault
== NULL
? NULL
: *fault
);
164 if (!TEST_ptr(BIO_push(fisbio
, sbio
)))
167 tserver_args
.libctx
= libctx
;
168 tserver_args
.net_rbio
= sbio
;
169 tserver_args
.net_wbio
= fisbio
;
170 tserver_args
.alpn
= NULL
;
171 if ((flags
& QTEST_FLAG_FAKE_TIME
) != 0) {
172 fake_now
= ossl_time_zero();
173 tserver_args
.now_cb
= fake_now_cb
;
176 if (!TEST_ptr(*qtserv
= ossl_quic_tserver_new(&tserver_args
, certfile
,
180 /* Ownership of fisbio and sbio is now held by *qtserv */
185 (*fault
)->qtserv
= *qtserv
;
187 BIO_ADDR_free(peeraddr
);
191 BIO_ADDR_free(peeraddr
);
197 ossl_quic_tserver_free(*qtserv
);
199 OPENSSL_free(*fault
);
204 void qtest_add_time(uint64_t millis
)
206 fake_now
= ossl_time_add(fake_now
, ossl_ms2time(millis
));
209 int qtest_supports_blocking(void)
211 #if !defined(OPENSSL_NO_POSIX_IO) && defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
218 #define MAXLOOPS 1000
220 #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
221 static int globserverret
= 0;
222 static QUIC_TSERVER
*globtserv
;
223 static const thread_t thread_zero
;
225 static void run_server_thread(void)
228 * This will operate in a busy loop because the server does not block,
229 * but should be acceptable because it is local and we expect this to be
232 globserverret
= qtest_create_quic_connection(globtserv
, NULL
);
236 int qtest_create_quic_connection(QUIC_TSERVER
*qtserv
, SSL
*clientssl
)
238 int retc
= -1, rets
= 0, err
, abortctr
= 0, ret
= 0;
239 int clienterr
= 0, servererr
= 0;
240 #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
242 * Pointless initialisation to avoid bogus compiler warnings about using
245 thread_t t
= thread_zero
;
248 if (!TEST_ptr(qtserv
)) {
250 } else if (clientssl
== NULL
) {
252 } else if (SSL_get_blocking_mode(clientssl
) > 0) {
253 #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
255 * clientssl is blocking. We will need a thread to complete the
259 if (!TEST_true(run_thread(&t
, run_server_thread
)))
265 TEST_error("No thread support in this build");
271 err
= SSL_ERROR_WANT_WRITE
;
272 while (!clienterr
&& retc
<= 0 && err
== SSL_ERROR_WANT_WRITE
) {
273 retc
= SSL_connect(clientssl
);
275 err
= SSL_get_error(clientssl
, retc
);
278 if (!clienterr
&& retc
<= 0 && err
!= SSL_ERROR_WANT_READ
) {
279 TEST_info("SSL_connect() failed %d, %d", retc
, err
);
280 TEST_openssl_errors();
285 * We're cheating. We don't take any notice of SSL_get_tick_timeout()
286 * and tick every time around the loop anyway. This is inefficient. We
287 * can get away with it in test code because we control both ends of
288 * the communications and don't expect network delays. This shouldn't
289 * be done in a real application.
291 if (!clienterr
&& retc
<= 0)
292 SSL_handle_events(clientssl
);
293 if (!servererr
&& rets
<= 0) {
295 ossl_quic_tserver_tick(qtserv
);
296 servererr
= ossl_quic_tserver_is_term_any(qtserv
);
298 rets
= ossl_quic_tserver_is_handshake_confirmed(qtserv
);
301 if (clienterr
&& servererr
)
304 if (clientssl
!= NULL
&& ++abortctr
== MAXLOOPS
) {
305 TEST_info("No progress made");
308 } while ((retc
<= 0 && !clienterr
) || (rets
<= 0 && !servererr
));
310 if (qtserv
== NULL
&& rets
> 0) {
311 #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
312 if (!TEST_true(wait_for_thread(t
)) || !TEST_true(globserverret
))
315 TEST_error("Should not happen");
320 if (!clienterr
&& !servererr
)
326 int qtest_shutdown(QUIC_TSERVER
*qtserv
, SSL
*clientssl
)
328 /* Busy loop in non-blocking mode. It should be quick because its local */
329 while (SSL_shutdown(clientssl
) != 1)
330 ossl_quic_tserver_tick(qtserv
);
335 int qtest_check_server_transport_err(QUIC_TSERVER
*qtserv
, uint64_t code
)
337 const QUIC_TERMINATE_CAUSE
*cause
;
339 ossl_quic_tserver_tick(qtserv
);
342 * Check that the server has closed with the specified code from the client
344 if (!TEST_true(ossl_quic_tserver_is_term_any(qtserv
)))
347 cause
= ossl_quic_tserver_get_terminate_cause(qtserv
);
349 || !TEST_true(cause
->remote
)
350 || !TEST_false(cause
->app
)
351 || !TEST_uint64_t_eq(cause
->error_code
, code
))
357 int qtest_check_server_protocol_err(QUIC_TSERVER
*qtserv
)
359 return qtest_check_server_transport_err(qtserv
, QUIC_ERR_PROTOCOL_VIOLATION
);
362 int qtest_check_server_frame_encoding_err(QUIC_TSERVER
*qtserv
)
364 return qtest_check_server_transport_err(qtserv
, QUIC_ERR_FRAME_ENCODING_ERROR
);
367 void qtest_fault_free(QTEST_FAULT
*fault
)
372 packet_plain_finish(fault
);
373 handshake_finish(fault
);
378 static int packet_plain_mutate(const QUIC_PKT_HDR
*hdrin
,
379 const OSSL_QTX_IOVEC
*iovecin
, size_t numin
,
380 QUIC_PKT_HDR
**hdrout
,
381 const OSSL_QTX_IOVEC
**iovecout
,
385 QTEST_FAULT
*fault
= arg
;
389 /* Coalesce our data into a single buffer */
391 /* First calculate required buffer size */
392 for (i
= 0; i
< numin
; i
++)
393 bufsz
+= iovecin
[i
].buf_len
;
395 fault
->pplainio
.buf_len
= bufsz
;
397 /* Add an allowance for possible growth */
398 bufsz
+= GROWTH_ALLOWANCE
;
400 fault
->pplainio
.buf
= cur
= OPENSSL_malloc(bufsz
);
402 fault
->pplainio
.buf_len
= 0;
406 fault
->pplainbuf_alloc
= bufsz
;
408 /* Copy in the data from the input buffers */
409 for (i
= 0; i
< numin
; i
++) {
410 memcpy(cur
, iovecin
[i
].buf
, iovecin
[i
].buf_len
);
411 cur
+= iovecin
[i
].buf_len
;
414 fault
->pplainhdr
= *hdrin
;
416 /* Cast below is safe because we allocated the buffer */
417 if (fault
->pplaincb
!= NULL
418 && !fault
->pplaincb(fault
, &fault
->pplainhdr
,
419 (unsigned char *)fault
->pplainio
.buf
,
420 fault
->pplainio
.buf_len
, fault
->pplaincbarg
))
423 *hdrout
= &fault
->pplainhdr
;
424 *iovecout
= &fault
->pplainio
;
430 static void packet_plain_finish(void *arg
)
432 QTEST_FAULT
*fault
= arg
;
434 /* Cast below is safe because we allocated the buffer */
435 OPENSSL_free((unsigned char *)fault
->pplainio
.buf
);
436 fault
->pplainio
.buf_len
= 0;
437 fault
->pplainbuf_alloc
= 0;
438 fault
->pplainio
.buf
= NULL
;
441 int qtest_fault_set_packet_plain_listener(QTEST_FAULT
*fault
,
442 qtest_fault_on_packet_plain_cb pplaincb
,
445 fault
->pplaincb
= pplaincb
;
446 fault
->pplaincbarg
= pplaincbarg
;
448 return ossl_quic_tserver_set_plain_packet_mutator(fault
->qtserv
,
454 /* To be called from a packet_plain_listener callback */
455 int qtest_fault_resize_plain_packet(QTEST_FAULT
*fault
, size_t newlen
)
458 size_t oldlen
= fault
->pplainio
.buf_len
;
461 * Alloc'd size should always be non-zero, so if this fails we've been
464 if (fault
->pplainbuf_alloc
== 0)
467 if (newlen
> fault
->pplainbuf_alloc
) {
468 /* This exceeds our growth allowance. Fail */
472 /* Cast below is safe because we allocated the buffer */
473 buf
= (unsigned char *)fault
->pplainio
.buf
;
475 if (newlen
> oldlen
) {
476 /* Extend packet with 0 bytes */
477 memset(buf
+ oldlen
, 0, newlen
- oldlen
);
478 } /* else we're truncating or staying the same */
480 fault
->pplainio
.buf_len
= newlen
;
481 fault
->pplainhdr
.len
= newlen
;
487 * Prepend frame data into a packet. To be called from a packet_plain_listener
490 int qtest_fault_prepend_frame(QTEST_FAULT
*fault
, unsigned char *frame
,
497 * Alloc'd size should always be non-zero, so if this fails we've been
500 if (fault
->pplainbuf_alloc
== 0)
503 /* Cast below is safe because we allocated the buffer */
504 buf
= (unsigned char *)fault
->pplainio
.buf
;
505 old_len
= fault
->pplainio
.buf_len
;
507 /* Extend the size of the packet by the size of the new frame */
508 if (!TEST_true(qtest_fault_resize_plain_packet(fault
,
509 old_len
+ frame_len
)))
512 memmove(buf
+ frame_len
, buf
, old_len
);
513 memcpy(buf
, frame
, frame_len
);
518 static int handshake_mutate(const unsigned char *msgin
, size_t msginlen
,
519 unsigned char **msgout
, size_t *msgoutlen
,
522 QTEST_FAULT
*fault
= arg
;
524 unsigned long payloadlen
;
525 unsigned int msgtype
;
528 buf
= OPENSSL_malloc(msginlen
+ GROWTH_ALLOWANCE
);
532 fault
->handbuf
= buf
;
533 fault
->handbuflen
= msginlen
;
534 fault
->handbufalloc
= msginlen
+ GROWTH_ALLOWANCE
;
535 memcpy(buf
, msgin
, msginlen
);
537 if (!PACKET_buf_init(&pkt
, buf
, msginlen
)
538 || !PACKET_get_1(&pkt
, &msgtype
)
539 || !PACKET_get_net_3(&pkt
, &payloadlen
)
540 || PACKET_remaining(&pkt
) != payloadlen
)
543 /* Parse specific message types */
545 case SSL3_MT_ENCRYPTED_EXTENSIONS
:
547 QTEST_ENCRYPTED_EXTENSIONS ee
;
549 if (fault
->encextcb
== NULL
)
553 * The EncryptedExtensions message is very simple. It just has an
554 * extensions block in it and nothing else.
556 ee
.extensions
= (unsigned char *)PACKET_data(&pkt
);
557 ee
.extensionslen
= payloadlen
;
558 if (!fault
->encextcb(fault
, &ee
, payloadlen
, fault
->encextcbarg
))
563 /* No specific handlers for these message types yet */
567 if (fault
->handshakecb
!= NULL
568 && !fault
->handshakecb(fault
, buf
, fault
->handbuflen
,
569 fault
->handshakecbarg
))
573 *msgoutlen
= fault
->handbuflen
;
578 static void handshake_finish(void *arg
)
580 QTEST_FAULT
*fault
= arg
;
582 OPENSSL_free(fault
->handbuf
);
583 fault
->handbuf
= NULL
;
586 int qtest_fault_set_handshake_listener(QTEST_FAULT
*fault
,
587 qtest_fault_on_handshake_cb handshakecb
,
588 void *handshakecbarg
)
590 fault
->handshakecb
= handshakecb
;
591 fault
->handshakecbarg
= handshakecbarg
;
593 return ossl_quic_tserver_set_handshake_mutator(fault
->qtserv
,
599 int qtest_fault_set_hand_enc_ext_listener(QTEST_FAULT
*fault
,
600 qtest_fault_on_enc_ext_cb encextcb
,
603 fault
->encextcb
= encextcb
;
604 fault
->encextcbarg
= encextcbarg
;
606 return ossl_quic_tserver_set_handshake_mutator(fault
->qtserv
,
612 /* To be called from a handshake_listener callback */
613 int qtest_fault_resize_handshake(QTEST_FAULT
*fault
, size_t newlen
)
616 size_t oldlen
= fault
->handbuflen
;
619 * Alloc'd size should always be non-zero, so if this fails we've been
622 if (fault
->handbufalloc
== 0)
625 if (newlen
> fault
->handbufalloc
) {
626 /* This exceeds our growth allowance. Fail */
630 buf
= (unsigned char *)fault
->handbuf
;
632 if (newlen
> oldlen
) {
633 /* Extend packet with 0 bytes */
634 memset(buf
+ oldlen
, 0, newlen
- oldlen
);
635 } /* else we're truncating or staying the same */
637 fault
->handbuflen
= newlen
;
641 /* To be called from message specific listener callbacks */
642 int qtest_fault_resize_message(QTEST_FAULT
*fault
, size_t newlen
)
644 /* First resize the underlying message */
645 if (!qtest_fault_resize_handshake(fault
, newlen
+ SSL3_HM_HEADER_LENGTH
))
648 /* Fixup the handshake message header */
649 fault
->handbuf
[1] = (unsigned char)((newlen
>> 16) & 0xff);
650 fault
->handbuf
[2] = (unsigned char)((newlen
>> 8) & 0xff);
651 fault
->handbuf
[3] = (unsigned char)((newlen
) & 0xff);
656 int qtest_fault_delete_extension(QTEST_FAULT
*fault
,
657 unsigned int exttype
, unsigned char *ext
,
660 PACKET pkt
, sub
, subext
;
662 const unsigned char *start
, *end
;
664 size_t msglen
= fault
->handbuflen
;
666 if (!PACKET_buf_init(&pkt
, ext
, *extlen
))
669 /* Extension block starts with 2 bytes for extension block length */
670 if (!PACKET_as_length_prefixed_2(&pkt
, &sub
))
674 start
= PACKET_data(&sub
);
675 if (!PACKET_get_net_2(&sub
, &type
)
676 || !PACKET_get_length_prefixed_2(&sub
, &subext
))
678 } while (type
!= exttype
);
681 end
= PACKET_data(&sub
);
684 * If we're not the last extension we need to move the rest earlier. The
685 * cast below is safe because we own the underlying buffer and we're no
686 * longer making PACKET calls.
688 if (end
< ext
+ *extlen
)
689 memmove((unsigned char *)start
, end
, end
- start
);
692 * Calculate new extensions payload length =
694 * - 2 extension block length bytes
695 * - length of removed extension
697 newlen
= *extlen
- 2 - (end
- start
);
699 /* Fixup the length bytes for the extension block */
700 ext
[0] = (unsigned char)((newlen
>> 8) & 0xff);
701 ext
[1] = (unsigned char)((newlen
) & 0xff);
704 * Length of the whole extension block is the new payload length plus the
705 * 2 bytes for the length
707 *extlen
= newlen
+ 2;
709 /* We can now resize the message */
710 if ((size_t)(end
- start
) + SSL3_HM_HEADER_LENGTH
> msglen
)
711 return 0; /* Should not happen */
712 msglen
-= (end
- start
) + SSL3_HM_HEADER_LENGTH
;
713 if (!qtest_fault_resize_message(fault
, msglen
))
719 #define BIO_TYPE_CIPHER_PACKET_FILTER (0x80 | BIO_TYPE_FILTER)
721 static BIO_METHOD
*pcipherbiometh
= NULL
;
723 # define BIO_MSG_N(array, stride, n) (*(BIO_MSG *)((char *)(array) + (n)*(stride)))
725 static int pcipher_sendmmsg(BIO
*b
, BIO_MSG
*msg
, size_t stride
,
726 size_t num_msg
, uint64_t flags
,
727 size_t *num_processed
)
730 BIO
*next
= BIO_next(b
);
731 ossl_ssize_t ret
= 0;
732 size_t i
= 0, tmpnump
;
735 unsigned char *tmpdata
;
740 fault
= BIO_get_data(b
);
742 || (fault
->pciphercb
== NULL
&& fault
->datagramcb
== NULL
))
743 return BIO_sendmmsg(next
, msg
, stride
, num_msg
, flags
, num_processed
);
750 for (i
= 0; i
< num_msg
; ++i
) {
751 fault
->msg
= BIO_MSG_N(msg
, stride
, i
);
753 /* Take a copy of the data so that callbacks can modify it */
754 tmpdata
= OPENSSL_malloc(fault
->msg
.data_len
+ GROWTH_ALLOWANCE
);
757 memcpy(tmpdata
, fault
->msg
.data
, fault
->msg
.data_len
);
758 fault
->msg
.data
= tmpdata
;
759 fault
->msgalloc
= fault
->msg
.data_len
+ GROWTH_ALLOWANCE
;
761 if (fault
->pciphercb
!= NULL
) {
762 if (!PACKET_buf_init(&pkt
, fault
->msg
.data
, fault
->msg
.data_len
))
766 if (!ossl_quic_wire_decode_pkt_hdr(&pkt
,
767 0 /* TODO(QUIC): Not sure how this should be set*/, 1,
772 * hdr.data is const - but its our buffer so casting away the
775 if (!fault
->pciphercb(fault
, &hdr
, (unsigned char *)hdr
.data
,
776 hdr
.len
, fault
->pciphercbarg
))
780 * TODO(QUIC): At the moment modifications to hdr by the callback
781 * are ignored. We might need to rewrite the QUIC header to
782 * enable tests to change this. We also don't yet have a
783 * mechanism for the callback to change the encrypted data
784 * length. It's not clear if that's needed or not.
786 } while (PACKET_remaining(&pkt
) > 0);
789 if (fault
->datagramcb
!= NULL
790 && !fault
->datagramcb(fault
, &fault
->msg
, stride
,
791 fault
->datagramcbarg
))
794 if (!BIO_sendmmsg(next
, &fault
->msg
, stride
, 1, flags
, &tmpnump
)) {
799 OPENSSL_free(fault
->msg
.data
);
800 fault
->msg
.data
= NULL
;
807 OPENSSL_free(fault
->msg
.data
);
808 fault
->msg
.data
= NULL
;
812 static long pcipher_ctrl(BIO
*b
, int cmd
, long larg
, void *parg
)
814 BIO
*next
= BIO_next(b
);
819 return BIO_ctrl(next
, cmd
, larg
, parg
);
822 static BIO_METHOD
*get_bio_method(void)
826 if (pcipherbiometh
!= NULL
)
827 return pcipherbiometh
;
829 tmp
= BIO_meth_new(BIO_TYPE_CIPHER_PACKET_FILTER
, "Cipher Packet Filter");
834 if (!TEST_true(BIO_meth_set_sendmmsg(tmp
, pcipher_sendmmsg
))
835 || !TEST_true(BIO_meth_set_ctrl(tmp
, pcipher_ctrl
)))
838 pcipherbiometh
= tmp
;
842 return pcipherbiometh
;
845 int qtest_fault_set_packet_cipher_listener(QTEST_FAULT
*fault
,
846 qtest_fault_on_packet_cipher_cb pciphercb
,
849 fault
->pciphercb
= pciphercb
;
850 fault
->pciphercbarg
= pciphercbarg
;
855 int qtest_fault_set_datagram_listener(QTEST_FAULT
*fault
,
856 qtest_fault_on_datagram_cb datagramcb
,
859 fault
->datagramcb
= datagramcb
;
860 fault
->datagramcbarg
= datagramcbarg
;
865 /* To be called from a datagram_listener callback */
866 int qtest_fault_resize_datagram(QTEST_FAULT
*fault
, size_t newlen
)
868 if (newlen
> fault
->msgalloc
)
871 if (newlen
> fault
->msg
.data_len
)
872 memset((unsigned char *)fault
->msg
.data
+ fault
->msg
.data_len
, 0,
873 newlen
- fault
->msg
.data_len
);
875 fault
->msg
.data_len
= newlen
;