[Pkg-voip-commits] [pjproject] 02/14: asterisk/0001-r5397-pjsip_generic_array_max_count

Bernhard Schmidt berni at moszumanska.debian.org
Thu Nov 10 09:32:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

berni pushed a commit to branch master
in repository pjproject.

commit 3cefdceca19f214bc9c761d5b11a559b9e62f03f
Author: Bernhard Schmidt <berni at debian.org>
Date:   Thu Nov 10 09:45:29 2016 +0100

    asterisk/0001-r5397-pjsip_generic_array_max_count
    
    This patch updates array limit checks and docs
    in pjsip_evsub_register_pkg() and pjsip_endpt_add_capability().
    
    Patch-Category: asterisk
---
 pjsip/include/pjsip-simple/evsub.h | 3 ++-
 pjsip/include/pjsip/sip_endpoint.h | 3 ++-
 pjsip/src/pjsip-simple/evsub.c     | 4 +++-
 pjsip/src/pjsip/sip_endpoint.c     | 1 +
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/pjsip/include/pjsip-simple/evsub.h b/pjsip/include/pjsip-simple/evsub.h
index 8c8fb85..405a0cd 100644
--- a/pjsip/include/pjsip-simple/evsub.h
+++ b/pjsip/include/pjsip-simple/evsub.h
@@ -246,7 +246,8 @@ PJ_DECL(pjsip_module*) pjsip_evsub_instance(void);
  *			registered.
  * @param event_name	Event package identification.
  * @param expires	Default subscription expiration time, in seconds.
- * @param accept_cnt	Number of strings in Accept array.
+ * @param accept_cnt	Number of strings in Accept array. The value must
+ *			not be greater than PJSIP_GENERIC_ARRAY_MAX_COUNT.
  * @param accept	Array of Accept value.
  *
  * @return		PJ_SUCCESS on success.
diff --git a/pjsip/include/pjsip/sip_endpoint.h b/pjsip/include/pjsip/sip_endpoint.h
index 2c02965..fbc9a6e 100644
--- a/pjsip/include/pjsip/sip_endpoint.h
+++ b/pjsip/include/pjsip/sip_endpoint.h
@@ -583,7 +583,8 @@ PJ_DECL(pj_bool_t) pjsip_endpt_has_capability( pjsip_endpoint *endpt,
  * @param hname	    If htype specifies PJSIP_H_OTHER, then the header name
  *		    must be supplied in this argument. Otherwise the value
  *		    must be set to NULL.
- * @param count	    The number of tags in the array.
+ * @param count	    The number of tags in the array. The value must not
+ *		    be greater than PJSIP_GENERIC_ARRAY_MAX_COUNT.
  * @param tags	    Array of tags describing the capabilities or extensions
  *		    to be added to the appropriate header.
  *
diff --git a/pjsip/src/pjsip-simple/evsub.c b/pjsip/src/pjsip-simple/evsub.c
index 8d0f516..c5821dc 100644
--- a/pjsip/src/pjsip-simple/evsub.c
+++ b/pjsip/src/pjsip-simple/evsub.c
@@ -412,7 +412,9 @@ PJ_DEF(pj_status_t) pjsip_evsub_register_pkg( pjsip_module *pkg_mod,
     unsigned i;
 
     PJ_ASSERT_RETURN(pkg_mod && event_name, PJ_EINVAL);
-    PJ_ASSERT_RETURN(accept_cnt < PJ_ARRAY_SIZE(pkg->pkg_accept->values), 
+    
+    /* Make sure accept_cnt < PJ_ARRAY_SIZE(pkg->pkg_accept->values) */
+    PJ_ASSERT_RETURN(accept_cnt <= PJSIP_GENERIC_ARRAY_MAX_COUNT, 
 		     PJ_ETOOMANY);
 
     /* Make sure evsub module has been initialized */
diff --git a/pjsip/src/pjsip/sip_endpoint.c b/pjsip/src/pjsip/sip_endpoint.c
index b606b19..7889851 100644
--- a/pjsip/src/pjsip/sip_endpoint.c
+++ b/pjsip/src/pjsip/sip_endpoint.c
@@ -371,6 +371,7 @@ PJ_DEF(pj_status_t) pjsip_endpt_add_capability( pjsip_endpoint *endpt,
 
     /* Check arguments. */
     PJ_ASSERT_RETURN(endpt!=NULL && count>0 && tags, PJ_EINVAL);
+    PJ_ASSERT_RETURN(count <= PJSIP_GENERIC_ARRAY_MAX_COUNT, PJ_ETOOMANY);
     PJ_ASSERT_RETURN(htype==PJSIP_H_ACCEPT || 
 		     htype==PJSIP_H_ALLOW ||
 		     htype==PJSIP_H_SUPPORTED,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/pjproject.git



More information about the Pkg-voip-commits mailing list