prevent CapiSuite from crashing when a too high DDIBaseLength was

configured, thx to Michael Ressel for reporting and analyzing



git-svn-id: https://svn.ibp.de/svn/capisuite/trunk/capisuite@309 4ebea2bb-67d4-0310-8558-a5799e421b66
This commit is contained in:
gernot 2004-06-10 20:48:11 +00:00
parent 5f496ee11c
commit 9f5d6ed52a
2 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2004-06-10 Gernot Hillier <gernot@hillier.de>
* src/backend/connection.cpp (info_ind_called_party_nr): prevent
CapiSuite from crashing when a too high DDIBaseLength was configured,
thx to Michael Ressel for reporting and analyzing
2004-05-18 Gernot Hillier <gernot@hillier.de>
* docs/Makefile.am: remove PDF generation as it doesn't work currently;
adapt Makefiles to only create man pages for "make dist"; break long

View File

@ -16,6 +16,7 @@
#include "../../config.h"
#include <fstream>
#include <stdexcept> // for out_of_range
#include <pthread.h>
#include <errno.h> // for errno
#include <iconv.h> // for iconv(), iconv_open(), iconv_close()
@ -595,20 +596,30 @@ bool
Connection::info_ind_called_party_nr(_cmsg &message) throw (CapiError,CapiWrongState)
{
if (plci_state!=P2)
throw CapiWrongState("INFO_IND for CalledPartyNr received in wrong state","Connection::info_ind_called_party_nr()");
throw CapiWrongState("INFO_IND for CalledPartyNr received in wrong state",
"Connection::info_ind_called_party_nr()");
if (plci!=INFO_IND_PLCI(&message))
throw CapiError("INFO_IND received with wrong PLCI","Connection::info_ind_called_party_nr()");
throw CapiError("INFO_IND received with wrong PLCI",
"Connection::info_ind_called_party_nr()");
try {
capi->info_resp(message.Messagenumber,plci);
}
catch (CapiMsgError e) {
error << prefix() << "WARNING: Can't send info_resp. Message was: " << e << endl;
error << prefix() << "WARNING: Can't send info_resp. Message was: " <<
e << endl;
}
call_to+=getNumber(INFO_IND_INFOELEMENT(&message),false);
string currDDI=call_to.substr(DDIBaseLength);
string currDDI;
try {
currDDI=call_to.substr(DDIBaseLength);
}
catch (std::out_of_range e) {
throw CapiError("DDIBaseLength too big - configuration error?",
"Connection::info_ind_called_party_nr()");
}
for (int i=0;i<DDIStopNumbers.size();i++)
if (DDIStopNumbers[i]==currDDI) {
if (debug_level >= 1)