summaryrefslogtreecommitdiff
path: root/proto/bmp/bmp.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2023-06-08 05:10:05 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2023-06-08 05:10:05 +0200
commit43d41d8449a4eb196422d6d309dbea998d920541 (patch)
tree657640e7b5f3dfce467d63d459bcf44f8255da30 /proto/bmp/bmp.c
parente8838d930cd5c875f32aa2b7da5d84995b14ccac (diff)
BMP: Ensure that bmp_fire_tx() does nothing when not up
Diffstat (limited to 'proto/bmp/bmp.c')
-rw-r--r--proto/bmp/bmp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/proto/bmp/bmp.c b/proto/bmp/bmp.c
index aed9d9d6..c530b3d4 100644
--- a/proto/bmp/bmp.c
+++ b/proto/bmp/bmp.c
@@ -273,7 +273,10 @@ static void
bmp_fire_tx(void *p_)
{
struct bmp_proto *p = p_;
- byte *buf = p->sk->tbuf;
+
+ if (!p->started)
+ return;
+
IF_COND_TRUE_PRINT_ERR_MSG_AND_RETURN_OPT_VAL(
EMPTY_LIST(p->tx_queue),
"Called BMP TX event handler when there is not any data to send"
@@ -290,7 +293,7 @@ bmp_fire_tx(void *p_)
}
size_t data_size = tx_data->data_size;
- memcpy(buf, tx_data->data, tx_data->data_size);
+ memcpy(p->sk->tbuf, tx_data->data, data_size);
mb_free(tx_data->data);
rem_node((node *) tx_data);
mb_free(tx_data);