From cb269158f0f81455efee7d58f4499c611c1cf508 Mon Sep 17 00:00:00 2001 From: Dmitriy Gerasimov <naeper@demlabs.net> Date: Wed, 15 May 2019 22:21:39 +0700 Subject: [PATCH] [*] Now ch_pkt_write function could work with null data input --- dap_stream_ch_pkt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dap_stream_ch_pkt.c b/dap_stream_ch_pkt.c index fbbe497..6124a0c 100755 --- a/dap_stream_ch_pkt.c +++ b/dap_stream_ch_pkt.c @@ -78,7 +78,8 @@ size_t dap_stream_ch_pkt_write(struct dap_stream_ch * a_ch, uint8_t a_type, con a_data_size=sizeof(a_ch->buf)-sizeof(l_hdr); } memcpy(a_ch->buf,&l_hdr,sizeof(l_hdr) ); - memcpy(a_ch->buf+sizeof(l_hdr),a_data,a_data_size ); + if( a_data_size ) + memcpy(a_ch->buf+sizeof(l_hdr),a_data,a_data_size ); size_t l_ret=dap_stream_pkt_write(a_ch->stream,a_ch->buf,a_data_size+sizeof(l_hdr)); a_ch->stat.bytes_write+=a_data_size; -- GitLab