diff -r ac7f88fb2797 -r b3a7d8e28262 syncmlfw/dm/provisioningadapter/src/NSmlDmProvisioningAdapter.cpp --- a/syncmlfw/dm/provisioningadapter/src/NSmlDmProvisioningAdapter.cpp Fri Jun 25 14:05:15 2010 +0100 +++ b/syncmlfw/dm/provisioningadapter/src/NSmlDmProvisioningAdapter.cpp Thu Jul 22 16:43:13 2010 +0100 @@ -40,6 +40,8 @@ #include "NSmlTransportHandler.h" #include +#define KMINPORT 0 +#define KMAXPORT 65536 // ============================ MEMBER FUNCTIONS =============================== @@ -184,7 +186,35 @@ iAuthSecretLimitIndicator = 0; User::Leave(KErrOverflow); } - + + //check for incorrect port + //Only port address between 1 to 65536 is allowed. + if( iProfiles[aItem]->iPort ) + { + const TDesC& port = iProfiles[aItem]->iPort->Des(); + TInt len = port.Length(); + if(len > 0) + { + HBufC* bufPort = port.AllocL(); + TLex aLex(*bufPort); + TInt portNum ; + TInt err = aLex.Val(portNum); + if(bufPort) + { + delete bufPort; + bufPort = NULL; + } + if(err != KErrNone) + { + User::Leave(KErrGeneral); + } + if(!((portNum > KMINPORT) && (portNum < KMAXPORT))) + { + User::Leave(KErrGeneral); + } + } + } + TPckgBuf uid; RSyncMLDevManProfile profile,ProfileToSearch; @@ -289,7 +319,7 @@ connection.SetPropertyL( KNSmlIAPId, *iapBuf ); - CleanupStack::PopAndDestroy( 2 ); //cmmanager,cm + CleanupStack::PopAndDestroy( 3 ); //cmmanager,cm, iapBuf } if( iProfiles[aItem]->iHostAddress )