fix bounds check issue

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@480 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Michael Jerris
2008-05-21 16:48:19 +00:00
parent 9053ab88e3
commit 33b748e114
2 changed files with 13 additions and 5 deletions

View File

@@ -718,6 +718,12 @@ zap_status_t zap_channel_open_any(uint32_t span_id, zap_direction_t direction, z
uint32_t span_max;
if (span_id) {
if (span_id >= ZAP_MAX_SPANS_INTERFACE) {
zap_log(ZAP_LOG_CRIT, "SPAN NOT DEFINED!\n");
*zchan = NULL;
return ZAP_FAIL;
}
if (globals.spans[span_id].active_count >= globals.spans[span_id].chan_count) {
zap_log(ZAP_LOG_CRIT, "All circuits are busy.\n");
*zchan = NULL;
@@ -907,14 +913,14 @@ zap_status_t zap_channel_open(uint32_t span_id, uint32_t chan_id, zap_channel_t
zap_mutex_lock(globals.mutex);
if (span_id && globals.spans[span_id].channel_request) {
zap_log(ZAP_LOG_ERROR, "Individual channel selection not implemented on this span.\n");
goto done;
}
if (span_id < ZAP_MAX_SPANS_INTERFACE && chan_id < ZAP_MAX_CHANNELS_SPAN) {
zap_channel_t *check;
if (globals.spans[span_id].channel_request) {
zap_log(ZAP_LOG_ERROR, "Individual channel selection not implemented on this span.\n");
goto done;
}
check = &globals.spans[span_id].channels[chan_id];
if (zap_test_flag(check, ZAP_CHANNEL_SUSPENDED) ||