Import Fixes: #348

Make adjustments to groupinfo struct; Misc tweaks to code using groupinfo items;

Move group_array from stack to heap; Calloc adequate memory for it;

Switch to strncpy to fix potential issues with large strings copying OOB and crashing;
This commit is contained in:
lwvmobile
2026-05-20 05:25:38 -04:00
parent ed1d1d630c
commit f443063d3b
5 changed files with 39 additions and 17 deletions

View File

@@ -1187,7 +1187,9 @@
//trunking
memset (state->trunk_lcn_freq, 0, sizeof(state->trunk_lcn_freq));
memset (state->trunk_chan_map, 0, sizeof(state->trunk_chan_map));
state->group_tally = 0;
//allocate max 24-bit address w/ memory with zero fill (termination) for end of strings, import will only copy 98, leaving the terminator intact
state->group_array = calloc(16778000, sizeof(groupinfo));
state->group_tally = 0; //is an unsigned int
state->lcn_freq_count = 0; //number of frequncies imported as an enumerated lcn list
state->lcn_freq_roll = 0; //needs reset if sync is found?
state->last_cc_sync_time = time(NULL);