Fix: Be more paranoid in checking DLC validity

This commit is contained in:
Denis Kenzior 2009-10-14 16:03:36 -05:00
parent 350141ac9b
commit a8af38d209
1 changed files with 13 additions and 1 deletions

View File

@ -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,
const void *data, int tofeed)
{
GAtMuxChannel *channel = mux->dlcs[dlc-1];
GAtMuxChannel *channel;
int written;
int offset;
int bit;
DBG("deliver_data: dlc: %d, channel: %p", dlc, channel);
if (dlc < 1 || dlc > MAX_CHANNELS)
return;
channel = mux->dlcs[dlc-1];
if (channel == NULL)
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)
{
GAtMuxChannel *channel;
DBG("Got status %d, for channel %d", status, channel);
if (dlc < 1 || dlc > MAX_CHANNELS)
return;
channel = mux->dlcs[dlc-1];
if (channel == NULL)
return;
if (status & G_AT_MUX_DLC_STATUS_RTR) {
GSList *l;