satengine/SatServer/Commands/CallControlCmd/src/CCallControlHandler.cpp
changeset 52 d841fb1cc818
parent 0 ff3b6d0fd310
--- a/satengine/SatServer/Commands/CallControlCmd/src/CCallControlHandler.cpp	Fri Sep 17 08:33:29 2010 +0300
+++ b/satengine/SatServer/Commands/CallControlCmd/src/CCallControlHandler.cpp	Mon Oct 04 00:54:29 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -30,6 +30,13 @@
 // USSD DCS coding.
 const TUint8 KSatDcs7Bit( 0x40 );
 
+ /** 
+  * USSD messages coded as a packed string within 160 octets, as defined for a 
+  * ussd-String within GSM 04.80 and GSM 03.38. if the Dcs is 7 bit, a ussd 
+  * string can have 182 charactor
+  */
+const TInt   KSatMaxUSSDString( 182 );
+
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -541,17 +548,22 @@
     TInt err( KErrNone );
     RSat::TUssdString ussdString;
     err = iCallControlData.GetSendUssdDetails ( ussdString );
+    //If the Dcs or string length is not valid we should not send the ussd.
+    if( !err )
+        {
+        if( !( iUtils->MultiModeApi().IsValidUssdDcs( ussdString.iDcs ) )
+            || ( KSatMaxUSSDString < ussdString.iUssdString.Length() ) )
+            {   
+            err = KErrArgument;
+            }
+        }
+    
     if ( !err )
         {
         LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendUssd string %S",
             &ussdString.iUssdString )
          
-        LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendUssd schema %d",
-            ussdString.iDcs )
-
         RMobileUssdMessaging::TMobileUssdAttributesV1 ussdAttr;
-        
-        
         if ( KSatDcs7Bit == ussdString.iDcs )
             {
             ussdAttr.iFormat= RMobileUssdMessaging::EFormatPackedString;
@@ -583,13 +595,12 @@
             err = KErrNoMemory;
             }    
         }
-
+    
     LOG2( NORMAL, "CALLCONTROL: CCallControlHandler::SendUssd exiting %d",
           err)
     return err;
     }
 
-
 // -----------------------------------------------------------------------------
 // CCallControlHandler::DispatchCcRequestComplete
 // (other items were commented in a header).