fixing weird gcc9 bug with strncpy

see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88780 for details
master
Andre Puschmann 5 years ago
parent 1d6f72b478
commit 2ec62f7fa9

@ -42,7 +42,7 @@ pthread_t rx_thread;
void* ue_rx_thread_function(void* args) void* ue_rx_thread_function(void* args)
{ {
char rf_args[PARAM_LEN]; char rf_args[PARAM_LEN];
strncpy(rf_args, (char*)args, PARAM_LEN); strncpy(rf_args, (char*)args, PARAM_LEN - 1);
rf_args[PARAM_LEN - 1] = 0; rf_args[PARAM_LEN - 1] = 0;
// sleep(1); // sleep(1);
@ -74,7 +74,7 @@ void* ue_rx_thread_function(void* args)
void enb_tx_function(const char* tx_args, bool timed_tx) void enb_tx_function(const char* tx_args, bool timed_tx)
{ {
char rf_args[PARAM_LEN]; char rf_args[PARAM_LEN];
strncpy(rf_args, tx_args, PARAM_LEN); strncpy(rf_args, tx_args, PARAM_LEN - 1);
rf_args[PARAM_LEN - 1] = 0; rf_args[PARAM_LEN - 1] = 0;
printf("opening tx device with args=%s\n", rf_args); printf("opening tx device with args=%s\n", rf_args);

Loading…
Cancel
Save