Fix buffer overflow and compiler warnings #2
|
@ -81,7 +81,7 @@ result_t packet_mod_set_data(packet_mod_ctx_t *ctx, const unsigned char *data, s
|
|||
memcpy(ctx->pkt_bytes, data, length);
|
||||
ctx->length = length;
|
||||
|
||||
ctx->raw_data_crc = crc_generate_key(PAYLOAD_CRC_SCHEME, data, length);
|
||||
ctx->raw_data_crc = crc_generate_key(PAYLOAD_CRC_SCHEME, (unsigned char *)data, length);
|
||||
ctx->raw_data_len = length;
|
||||
|
||||
ctx->state = DATA_RAW;
|
||||
|
|
|
@ -101,10 +101,10 @@ static bool acquire_preamble(layer1_rx_t *rx, const float complex sample, bool d
|
|||
// BPSK symbols and therefore can be used during ramp-up and preamble.
|
||||
|
||||
if(freq_est_holdoff_samples == 0) { //freq_est_history_write_idx == FREQ_EST_L) {
|
||||
float complex linearized_history[FREQ_EST_L];
|
||||
for(size_t i = 0; i < FREQ_EST_L; i++) {
|
||||
linearized_history[i] = freq_est_history[(i + freq_est_history_write_idx) % FREQ_EST_L];
|
||||
}
|
||||
//float complex linearized_history[FREQ_EST_L];
|
||||
//for(size_t i = 0; i < FREQ_EST_L; i++) {
|
||||
// linearized_history[i] = freq_est_history[(i + freq_est_history_write_idx) % FREQ_EST_L];
|
||||
//}
|
||||
|
||||
float freq_est = freq_est_in_rampup(freq_est_history, FREQ_EST_L, NULL);
|
||||
|
||||
|
@ -148,7 +148,7 @@ static bool acquire_preamble(layer1_rx_t *rx, const float complex sample, bool d
|
|||
}
|
||||
|
||||
|
||||
typedef enum squelch_state_t {
|
||||
enum squelch_state_t {
|
||||
SQUELCH_CLOSED,
|
||||
SQUELCH_OPEN,
|
||||
SQUELCH_JUST_OPENED,
|
||||
|
@ -331,7 +331,7 @@ result_t layer1_rx_process(layer1_rx_t *rx, const float complex *samples, size_t
|
|||
header_enc, 8, sizeof(header_enc), &nsyms));
|
||||
|
||||
if(fec_decode(rx->hdr_fec, sizeof(header), header_enc, header) != LIQUID_OK) {
|
||||
DEBUG_LOG("Header decoding failed!\n", rx->modcod);
|
||||
DEBUG_LOG("Header decoding failed!\n");
|
||||
rx->state = RX_STATE_ACQUISITION;
|
||||
rx->callback(RX_EVT_HEADER_ERROR, NULL, 0);
|
||||
break;
|
||||
|
|
|
@ -164,7 +164,7 @@ result_t layer1_tx_finalize_burst(layer1_tx_t *tx)
|
|||
// allocate a temporary buffer
|
||||
float complex *tmp = malloc(sizeof(float complex) * tx->samples_used);
|
||||
if(!tmp) {
|
||||
fprintf(stderr, "Could not allocate buffer for TX frequency correction.\n", len, tx->samples_used);
|
||||
fprintf(stderr, "Could not allocate buffer for TX frequency correction.\n");
|
||||
return ERR_NO_MEM;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <liquid/liquid.h>
|
||||
|
||||
|
|
|
@ -58,6 +58,9 @@ static result_t sdr_rf_to_baseband(nco_crcf nco, firdecim_crcf decim,
|
|||
|
||||
void cb_rx(rx_evt_t evt, uint8_t *packet_data, size_t packet_len)
|
||||
{
|
||||
(void)packet_data;
|
||||
(void)packet_len;
|
||||
|
||||
switch(evt)
|
||||
{
|
||||
case RX_EVT_CHECKSUM_ERROR:
|
||||
|
|
Loading…
Reference in a new issue