diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-10-14 16:03:36 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-10-15 16:15:17 -0500 |
commit | a8af38d209ecefcd9ab17670a18f445e95f575e2 (patch) | |
tree | b9542670f80ba35d9382836cd81086eaa35a1fff /gatchat/gatmux.c | |
parent | 350141ac9be54f9b91c328bfa7ce829e7329f658 (diff) | |
download | ofono-a8af38d209ecefcd9ab17670a18f445e95f575e2.tar.bz2 |
Fix: Be more paranoid in checking DLC validity
Diffstat (limited to 'gatchat/gatmux.c')
-rw-r--r-- | gatchat/gatmux.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gatchat/gatmux.c b/gatchat/gatmux.c index 424a5743..0b42ebcf 100644 --- a/gatchat/gatmux.c +++ b/gatchat/gatmux.c @@ -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; |