diff --git a/impl/src/layer2/layer2_tx.c b/impl/src/layer2/layer2_tx.c index 3f9815a..8277ca1 100644 --- a/impl/src/layer2/layer2_tx.c +++ b/impl/src/layer2/layer2_tx.c @@ -62,13 +62,14 @@ result_t layer2_tx_fill_packet_queue(layer2_tx_t *ctx) // a packet is available -> move it to the queue header.tx_seq_nr = ctx->next_seq_nr; - uint8_t *packetbuf = malloc(2048); + static const size_t packetbuf_size = 2048; + uint8_t *packetbuf = malloc(packetbuf_size); if(!packetbuf) { LOG(LVL_ERR, "malloc failed."); return ERR_NO_MEM; } - ret = read(ctx->tun_fd, packetbuf, sizeof(packetbuf)); + ret = read(ctx->tun_fd, packetbuf, packetbuf_size); if(ret < 0) { LOG(LVL_ERR, "read: %s", strerror(errno)); free(packetbuf);