mirror of git://git.sysmocom.de/ofono
Fix: Be more paranoid in checking DLC validity
This commit is contained in:
parent
350141ac9b
commit
a8af38d209
|
@ -306,13 +306,19 @@ int g_at_mux_raw_write(GAtMux *mux, const void *data, int towrite)
|
||||||
void g_at_mux_feed_dlc_data(GAtMux *mux, guint8 dlc,
|
void g_at_mux_feed_dlc_data(GAtMux *mux, guint8 dlc,
|
||||||
const void *data, int tofeed)
|
const void *data, int tofeed)
|
||||||
{
|
{
|
||||||
GAtMuxChannel *channel = mux->dlcs[dlc-1];
|
GAtMuxChannel *channel;
|
||||||
|
|
||||||
int written;
|
int written;
|
||||||
int offset;
|
int offset;
|
||||||
int bit;
|
int bit;
|
||||||
|
|
||||||
DBG("deliver_data: dlc: %d, channel: %p", dlc, channel);
|
DBG("deliver_data: dlc: %d, channel: %p", dlc, channel);
|
||||||
|
|
||||||
|
if (dlc < 1 || dlc > MAX_CHANNELS)
|
||||||
|
return;
|
||||||
|
|
||||||
|
channel = mux->dlcs[dlc-1];
|
||||||
|
|
||||||
if (channel == NULL)
|
if (channel == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -330,11 +336,17 @@ void g_at_mux_feed_dlc_data(GAtMux *mux, guint8 dlc,
|
||||||
|
|
||||||
void g_at_mux_set_dlc_status(GAtMux *mux, guint8 dlc, int status)
|
void g_at_mux_set_dlc_status(GAtMux *mux, guint8 dlc, int status)
|
||||||
{
|
{
|
||||||
|
GAtMuxChannel *channel;
|
||||||
|
|
||||||
DBG("Got status %d, for channel %d", status, channel);
|
DBG("Got status %d, for channel %d", status, channel);
|
||||||
|
|
||||||
if (dlc < 1 || dlc > MAX_CHANNELS)
|
if (dlc < 1 || dlc > MAX_CHANNELS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
channel = mux->dlcs[dlc-1];
|
||||||
|
if (channel == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (status & G_AT_MUX_DLC_STATUS_RTR) {
|
if (status & G_AT_MUX_DLC_STATUS_RTR) {
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue