diff --git a/src/ax25_link.c b/src/ax25_link.c index 52d7c15..05638a8 100644 --- a/src/ax25_link.c +++ b/src/ax25_link.c @@ -250,7 +250,7 @@ typedef struct ax25_dlsm_s { // notifications about state changes. - char addrs[AX25_MAX_REPEATERS][AX25_MAX_ADDR_LEN]; + char addrs[AX25_MAX_ADDRS][AX25_MAX_ADDR_LEN]; // Up to 10 addresses, same order as in frame. int num_addr; // Number of addresses. Should be in range 2 .. 10. @@ -1657,7 +1657,7 @@ void dl_outstanding_frames_request (dlq_item_t *E) // this is communicating with the client app, not over the air, // so we don't need to worry about digipeaters. - char swapped[AX25_MAX_REPEATERS][AX25_MAX_ADDR_LEN]; + char swapped[AX25_MAX_ADDRS][AX25_MAX_ADDR_LEN]; memset (swapped, 0, sizeof(swapped)); strlcpy (swapped[PEERCALL], E->addrs[OWNCALL], sizeof(swapped[PEERCALL])); strlcpy (swapped[OWNCALL], E->addrs[PEERCALL], sizeof(swapped[OWNCALL])); diff --git a/src/dlq.c b/src/dlq.c index 0d4b4a4..698df5a 100644 --- a/src/dlq.c +++ b/src/dlq.c @@ -728,8 +728,7 @@ void dlq_xmit_data_request (char addrs[AX25_MAX_ADDRS][AX25_MAX_ADDR_LEN], int n * * Purpose: Register callsigns that we will recognize for incoming connection requests. * - * Inputs: addrs - Source (owncall), destination (peercall), - * and possibly digipeaters. + * Inputs: addr - Callsign to [un]register. * * chan - Channel, 0 is first. * @@ -749,7 +748,7 @@ void dlq_xmit_data_request (char addrs[AX25_MAX_ADDRS][AX25_MAX_ADDR_LEN], int n *--------------------------------------------------------------------*/ -void dlq_register_callsign (char addr[AX25_MAX_ADDR_LEN], int chan, int client) +void dlq_register_callsign (char *addr, int chan, int client) { struct dlq_item_s *pnew; @@ -773,7 +772,7 @@ void dlq_register_callsign (char addr[AX25_MAX_ADDR_LEN], int chan, int client) pnew->type = DLQ_REGISTER_CALLSIGN; pnew->chan = chan; - strlcpy (pnew->addrs[0], addr, AX25_MAX_ADDR_LEN); + strlcpy (pnew->addrs[0], addr, sizeof(pnew->addrs[0])); pnew->num_addr = 1; pnew->client = client; @@ -784,7 +783,7 @@ void dlq_register_callsign (char addr[AX25_MAX_ADDR_LEN], int chan, int client) } /* end dlq_register_callsign */ -void dlq_unregister_callsign (char addr[AX25_MAX_ADDR_LEN], int chan, int client) +void dlq_unregister_callsign (char *addr, int chan, int client) { struct dlq_item_s *pnew; @@ -808,7 +807,7 @@ void dlq_unregister_callsign (char addr[AX25_MAX_ADDR_LEN], int chan, int client pnew->type = DLQ_UNREGISTER_CALLSIGN; pnew->chan = chan; - strlcpy (pnew->addrs[0], addr, AX25_MAX_ADDR_LEN); + strlcpy (pnew->addrs[0], addr, sizeof(pnew->addrs[0])); pnew->num_addr = 1; pnew->client = client; diff --git a/src/dlq.h b/src/dlq.h index 8771636..f07d330 100644 --- a/src/dlq.h +++ b/src/dlq.h @@ -116,9 +116,9 @@ void dlq_outstanding_frames_request (char addrs[AX25_MAX_ADDRS][AX25_MAX_ADDR_LE void dlq_xmit_data_request (char addrs[AX25_MAX_ADDRS][AX25_MAX_ADDR_LEN], int num_addr, int chan, int client, int pid, char *xdata_ptr, int xdata_len); -void dlq_register_callsign (char addr[AX25_MAX_ADDR_LEN], int chan, int client); +void dlq_register_callsign (char *addr, int chan, int client); -void dlq_unregister_callsign (char addr[AX25_MAX_ADDR_LEN], int chan, int client); +void dlq_unregister_callsign (char *addr, int chan, int client); void dlq_channel_busy (int chan, int activity, int status); diff --git a/src/server.c b/src/server.c index da20d0d..4faf7b7 100644 --- a/src/server.c +++ b/src/server.c @@ -1937,8 +1937,10 @@ static THREAD_F cmd_listen_thread (void *arg) case 'D': /* Send Connected Data */ { - char callsigns[2][AX25_MAX_ADDR_LEN]; - const int num_calls = 2; + char callsigns[AX25_MAX_ADDRS][AX25_MAX_ADDR_LEN]; + memset (callsigns, 0, sizeof(callsigns)); + const int num_calls = 2; // only first 2 used. Digipeater path + // must be remembered from connect request. strlcpy (callsigns[AX25_SOURCE], cmd.hdr.call_from, sizeof(callsigns[AX25_SOURCE])); strlcpy (callsigns[AX25_DESTINATION], cmd.hdr.call_to, sizeof(callsigns[AX25_SOURCE])); @@ -1951,8 +1953,9 @@ static THREAD_F cmd_listen_thread (void *arg) case 'd': /* Disconnect, Terminate an AX.25 Connection */ { - char callsigns[2][AX25_MAX_ADDR_LEN]; - const int num_calls = 2; + char callsigns[AX25_MAX_ADDRS][AX25_MAX_ADDR_LEN]; + memset (callsigns, 0, sizeof(callsigns)); + const int num_calls = 2; // only first 2 used. strlcpy (callsigns[AX25_SOURCE], cmd.hdr.call_from, sizeof(callsigns[AX25_SOURCE])); strlcpy (callsigns[AX25_DESTINATION], cmd.hdr.call_to, sizeof(callsigns[AX25_SOURCE])); @@ -2102,15 +2105,14 @@ static THREAD_F cmd_listen_thread (void *arg) { - char callsigns[2][AX25_MAX_ADDR_LEN]; - const int num_calls = 2; + char callsigns[AX25_MAX_ADDRS][AX25_MAX_ADDR_LEN]; + memset (callsigns, 0, sizeof(callsigns)); + const int num_calls = 2; // only first 2 used. strlcpy (callsigns[AX25_SOURCE], cmd.hdr.call_from, sizeof(callsigns[AX25_SOURCE])); strlcpy (callsigns[AX25_DESTINATION], cmd.hdr.call_to, sizeof(callsigns[AX25_SOURCE])); - // Issue 169. Proper implementation for 'Y'. dlq_outstanding_frames_request (callsigns, num_calls, cmd.hdr.portx, client); - } break;