]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Fixed buffer overflow issue caused by max number of destinations.
authorDi-Shi Sun <di-shi@transnexus.com>
Wed, 30 Nov 2011 07:17:13 +0000 (15:17 +0800)
committerDi-Shi Sun <di-shi@transnexus.com>
Wed, 30 Nov 2011 07:17:13 +0000 (15:17 +0800)
conf/autoload_configs/osp.conf.xml
src/mod/applications/mod_osp/mod_osp.c

index 4d1137ebcb7ac4f252bd06481a1fc2e02d3bf018..b320dbba88f7c7b5bc6921625a4b2fa56b11d3bc 100644 (file)
@@ -47,7 +47,7 @@
                        <!-- OSP service type, voice or npquery -->
                        <param name="service-type" value="voice"/>
                        <!-- Max number of destinations -->
-                       <param name="max-destinations" value="5"/>
+                       <param name="max-destinations" value="12"/>
                </profile>
        </profiles>
 </configuration>
index 7c839ecc1f213d8525b389503354a7187440a3f7..177542156004e3229fd34e0c15061a6608692e66 100644 (file)
 /* OSP Buffer Size Constants */
 #define OSP_SIZE_NORSTR                256             /* OSP normal string buffer size */
 #define OSP_SIZE_KEYSTR                1024    /* OSP certificate string buffer size */
-#define OSP_SIZE_ROUSTR                2048    /* OSP route buffer size */
+#define OSP_SIZE_ROUSTR                4096    /* OSP route buffer size */
 #define OSP_SIZE_TOKSTR                4096    /* OSP token string buffer size */
 
 /* OSP Settings Constants */
-#define OSP_MAX_SP                     8                       /* Max number of OSP service points */
-#define OSP_AUDIT_URL          "localhost"     /* OSP default Audit URL */
-#define OSP_LOCAL_VALID                1                       /* OSP token validating method, locally */
-#define OSP_DEF_LIFETIME       300                     /* OSP default SSL lifetime */
-#define OSP_DEF_MAXCONN                20                      /* OSP default max connections */
-#define OSP_MIN_MAXCONN                1                       /* OSP min max connections */
-#define OSP_MAX_MAXCONN                1000            /* OSP max max connections */
-#define OSP_DEF_PERSIST                60                      /* OSP default HTTP persistence in seconds */
-#define OSP_DEF_RETRYDELAY     0                       /* OSP default retry delay in seconds */
-#define OSP_MIN_RETRYDELAY     0                       /* OSP min retry delay */
-#define OSP_MAX_RETRYDELAY     10                      /* OSP max retry delay */
-#define OSP_DEF_RETRYLIMIT     2                       /* OSP default retry times */
-#define OSP_MIN_RETRYLIMIT     0                       /* OSP min retry times */
-#define OSP_MAX_RETRYLIMIT     100                     /* OSP max retry times */
-#define OSP_DEF_TIMEOUT                10000           /* OSP default timeout in ms */
-#define OSP_MIN_TIMEOUT                200                     /* OSP min timeout in ms */
-#define OSP_MAX_TIMEOUT                60000           /* OSP max timeout in ms */
-#define OSP_CUSTOMER_ID                ""                      /* OSP customer ID */
-#define OSP_DEVICE_ID          ""                      /* OSP device ID */
-#define OSP_DEF_MAXDEST                5                       /* OSP default max destinations */
-#define OSP_MIN_MAXDEST                1                       /* OSP min max destinations */
-#define OSP_MAX_MAXDEST                12                      /* OSP max max destinations */
-#define OSP_DEF_PROFILE                "default"       /* OSP default profile name */
-#define OSP_DEF_STRING         ""                      /* OSP default empty string */
-#define OSP_DEF_CALLID         "UNDEFINED"     /* OSP default Call-ID */
-#define OSP_DEF_STATS          -1                      /* OSP default statistics */
-#define OSP_URI_DELIM          '@'                     /* URI delimit */
-#define OSP_USER_DELIM         ";:"            /* URI userinfo delimit */
-#define OSP_HOST_DELIM         ";>"            /* URI hostport delimit */
-#define OSP_MAX_CINFO          8                       /* Max number of custom info */
+#define OSP_MAX_SP                     8                                       /* Max number of OSP service points */
+#define OSP_AUDIT_URL          "localhost"                     /* OSP default Audit URL */
+#define OSP_LOCAL_VALID                1                                       /* OSP token validating method, locally */
+#define OSP_DEF_LIFETIME       300                                     /* OSP default SSL lifetime */
+#define OSP_MIN_MAXCONN                1                                       /* OSP min max connections */
+#define OSP_MAX_MAXCONN                1000                            /* OSP max max connections */
+#define OSP_DEF_MAXCONN                20                                      /* OSP default max connections */
+#define OSP_DEF_PERSIST                60                                      /* OSP default HTTP persistence in seconds */
+#define OSP_MIN_RETRYDELAY     0                                       /* OSP min retry delay */
+#define OSP_MAX_RETRYDELAY     10                                      /* OSP max retry delay */
+#define OSP_DEF_RETRYDELAY     OSP_MIN_RETRYDELAY      /* OSP default retry delay in seconds */
+#define OSP_MIN_RETRYLIMIT     0                                       /* OSP min retry times */
+#define OSP_MAX_RETRYLIMIT     100                                     /* OSP max retry times */
+#define OSP_DEF_RETRYLIMIT     2                                       /* OSP default retry times */
+#define OSP_MIN_TIMEOUT                200                                     /* OSP min timeout in ms */
+#define OSP_MAX_TIMEOUT                60000                           /* OSP max timeout in ms */
+#define OSP_DEF_TIMEOUT                10000                           /* OSP default timeout in ms */
+#define OSP_CUSTOMER_ID                ""                                      /* OSP customer ID */
+#define OSP_DEVICE_ID          ""                                      /* OSP device ID */
+#define OSP_MIN_MAXDEST                1                                       /* OSP min max destinations */
+#define OSP_MAX_MAXDEST                12                                      /* OSP max max destinations */
+#define OSP_DEF_MAXDEST                OSP_MAX_MAXDEST         /* OSP default max destinations */
+#define OSP_DEF_PROFILE                "default"                       /* OSP default profile name */
+#define OSP_DEF_STRING         ""                                      /* OSP default empty string */
+#define OSP_DEF_CALLID         "UNDEFINED"                     /* OSP default Call-ID */
+#define OSP_DEF_STATS          -1                                      /* OSP default statistics */
+#define OSP_URI_DELIM          '@'                                     /* URI delimit */
+#define OSP_USER_DELIM         ";:"                            /* URI userinfo delimit */
+#define OSP_HOST_DELIM         ";>"                            /* URI hostport delimit */
+#define OSP_MAX_CINFO          8                                       /* Max number of custom info */
 
 /* OSP Handle Constant */
 #define OSP_INVALID_HANDLE     -1      /* Invalid OSP handle, provider, transaction etc. */
@@ -207,16 +207,16 @@ typedef struct osp_destination {
 } osp_destination_t;
 
 typedef struct osp_results {
-       const char *profile;                                    /* Profile name */
-       uint64_t transid;                                               /* Transaction ID */
-       switch_time_t start;                                    /* Call start time */
-       char calling[OSP_SIZE_NORSTR];                  /* Original calling number */
-       char called[OSP_SIZE_NORSTR];                   /* Original called number */
-       const char *srcdev;                                             /* Source device IP */
-       const char *srcnid;                                             /* Source network ID */
-       int status;                                                             /* AuthReq status */
-       int numdest;                                                    /* Number of destinations */
-       osp_destination_t dests[OSP_MAX_SP];    /* Destinations */
+       const char *profile;                                            /* Profile name */
+       uint64_t transid;                                                       /* Transaction ID */
+       switch_time_t start;                                            /* Call start time */
+       char calling[OSP_SIZE_NORSTR];                          /* Original calling number */
+       char called[OSP_SIZE_NORSTR];                           /* Original called number */
+       const char *srcdev;                                                     /* Source device IP */
+       const char *srcnid;                                                     /* Source network ID */
+       int status;                                                                     /* AuthReq status */
+       int numdest;                                                            /* Number of destinations */
+       osp_destination_t dests[OSP_MAX_MAXDEST];       /* Destinations */
 } osp_results_t;
 
 typedef struct osp_cookie {
@@ -2286,11 +2286,14 @@ static switch_status_t osp_report_usage(
                OSPPTransactionSetPackets(transaction, OSPC_SMETRIC_RTP, OSPC_SDIR_DESTREP, usage->rtpdestreppackets);
        }
 
+/* TODO: The logic to identify the last call attempt needs improvement.
        if ((cookie->destcount == cookie->desttotal) || (usage->cause == SWITCH_CAUSE_NORMAL_CLEARING)) {
                OSPPTransactionSetRoleInfo(transaction, OSPC_RSTATE_STOP, OSPC_RFORMAT_OSP, OSPC_RVENDOR_FREESWITCH);
        } else {
                OSPPTransactionSetRoleInfo(transaction, OSPC_RSTATE_INTERIM, OSPC_RFORMAT_OSP, OSPC_RVENDOR_FREESWITCH);
        }
+*/
+       OSPPTransactionSetRoleInfo(transaction, OSPC_RSTATE_STOP, OSPC_RFORMAT_OSP, OSPC_RVENDOR_FREESWITCH);
 
        info = (osp_threadarg_t *)malloc(sizeof(osp_threadarg_t));
        info->transaction = transaction;