Skip to content
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

app_rpt: Correct crash when using rpt page #377

Merged
merged 2 commits into from
Sep 14, 2024
Merged
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
18 changes: 11 additions & 7 deletions apps/app_rpt/rpt_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,32 +857,36 @@ static int rpt_do_page(int fd, int argc, const char *const *argv)
string_toupper(text);
snprintf(str, sizeof(str) - 1, "PAGE %s %s %s ", baud, capcode, text);
for (i = 6; i < argc; i++) {
if (i > 5)
if (i > 5) {
strncat(str, " ", sizeof(str) - 1);
}
strncat(str, argv[i], sizeof(str) - 1);
}
for (i = 0; i < nrpts; i++) {
if (!strcmp(nodename, rpt_vars[i].name)) {
struct rpt *myrpt = &rpt_vars[i];
/* ignore if not a USB channel */
/* BUGBUG XXX This looks wrong to me... won't it always be false? */
if (!strcasecmp(ast_channel_tech(myrpt->rxchannel)->type, "radio") &&
!strcasecmp(ast_channel_tech(myrpt->rxchannel)->type, "voter") &&
!strcasecmp(ast_channel_tech(myrpt->rxchannel)->type, "simpleusb")) {
/* ignore if not a channel that can accept the paging command */
if (strcasecmp(ast_channel_tech(myrpt->rxchannel)->type, "voter") &&
strcasecmp(ast_channel_tech(myrpt->rxchannel)->type, "simpleusb")) {
return RESULT_SUCCESS;
}
/* if we are playing telemetry, stop it now */
telem = myrpt->tele.next;
while (telem != &myrpt->tele) {
if (((telem->mode == ID) || (telem->mode == ID1) || (telem->mode == IDTALKOVER)) && (!telem->killed)) {
if (telem->chan)
if (telem->chan) {
ast_softhangup(telem->chan, AST_SOFTHANGUP_DEV); /* Whoosh! */
}
telem->killed = 1;
myrpt->deferid = 1;
}
telem = telem->next;
}
gettimeofday(&myrpt->paging, NULL);
rpt_mutex_lock(&myrpt->blocklock);
ast_sendtext(myrpt->rxchannel, str);
rpt_mutex_unlock(&myrpt->blocklock);
break;
}
}
return RESULT_SUCCESS;
Expand Down
Loading