Skip to content

Use proper buffer size in tt_user.c's digit_suffix #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/tt_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,13 @@ static int corral_slot (void)
*
*----------------------------------------------------------------*/

static void digit_suffix (char *callsign, char *suffix)
static void digit_suffix (char *callsign, char *suffix, size_t suffix_len)
{
char two_key[50];
char *t;


strlcpy (suffix, "000", 5); // TODO: should have proper size
strlcpy (suffix, "000", suffix_len);
tt_text_to_two_key (callsign, 0, two_key);
for (t = two_key; *t != '\0'; t++) {
if (isdigit(*t)) {
Expand Down Expand Up @@ -515,7 +515,7 @@ int tt_user_heard (char *callsign, int ssid, char overlay, char symbol, char *lo
tt_user[i].ssid = ssid;
tt_user[i].overlay = overlay;
tt_user[i].symbol = symbol;
digit_suffix(tt_user[i].callsign, tt_user[i].digit_suffix);
digit_suffix(tt_user[i].callsign, tt_user[i].digit_suffix, sizeof(tt_user[i].digit_suffix));
strlcpy (tt_user[i].loc_text, loc_text, sizeof(tt_user[i].loc_text));

if (latitude != G_UNKNOWN && longitude != G_UNKNOWN) {
Expand Down