Fixed stack overflow in transmit()

This commit is contained in:
Thomas Kolb 2024-07-20 01:03:31 +02:00
parent db2700c0f7
commit fe684f7a1d

View file

@ -142,12 +142,14 @@ void cb_rx(rx_evt_t evt, const struct layer1_rx_s *rx, uint8_t *packet_data, siz
static result_t transmit(sdr_ctx_t *sdr, const float complex *samples, size_t len) static result_t transmit(sdr_ctx_t *sdr, const float complex *samples, size_t len)
{ {
size_t to_transmit_rf = len * SDR_OVERSAMPLING; size_t to_transmit_rf = len * SDR_OVERSAMPLING;
float complex rf_samples[to_transmit_rf]; float complex *rf_samples = malloc(sizeof(*rf_samples) * to_transmit_rf);
RESULT_CHECK(sdr_baseband_to_rf(sdr, samples, len, rf_samples, &to_transmit_rf)); RESULT_CHECK(sdr_baseband_to_rf(sdr, samples, len, rf_samples, &to_transmit_rf));
result_t result = sdr_transmit(sdr, rf_samples, to_transmit_rf, 100000); result_t result = sdr_transmit(sdr, rf_samples, to_transmit_rf, 100000);
free(rf_samples);
fprintf(stderr, "t"); fprintf(stderr, "t");
return result; return result;
} }