1 This patch updates array limit checks and docs
2 in pjsip_evsub_register_pkg() and pjsip_endpt_add_capability().
4 Index: pjsip/include/pjsip/sip_endpoint.h
5 ===================================================================
6 --- a/pjsip/include/pjsip/sip_endpoint.h (revision 5396)
7 +++ b/pjsip/include/pjsip/sip_endpoint.h (revision 5397)
9 * @param hname If htype specifies PJSIP_H_OTHER, then the header name
10 * must be supplied in this argument. Otherwise the value
11 * must be set to NULL.
12 - * @param count The number of tags in the array.
13 + * @param count The number of tags in the array. The value must not
14 + * be greater than PJSIP_GENERIC_ARRAY_MAX_COUNT.
15 * @param tags Array of tags describing the capabilities or extensions
16 * to be added to the appropriate header.
18 Index: pjsip/include/pjsip-simple/evsub.h
19 ===================================================================
20 --- a/pjsip/include/pjsip-simple/evsub.h (revision 5396)
21 +++ b/pjsip/include/pjsip-simple/evsub.h (revision 5397)
24 * @param event_name Event package identification.
25 * @param expires Default subscription expiration time, in seconds.
26 - * @param accept_cnt Number of strings in Accept array.
27 + * @param accept_cnt Number of strings in Accept array. The value must
28 + * not be greater than PJSIP_GENERIC_ARRAY_MAX_COUNT.
29 * @param accept Array of Accept value.
31 * @return PJ_SUCCESS on success.
32 Index: pjsip/src/pjsip/sip_endpoint.c
33 ===================================================================
34 --- a/pjsip/src/pjsip/sip_endpoint.c (revision 5396)
35 +++ b/pjsip/src/pjsip/sip_endpoint.c (revision 5397)
38 /* Check arguments. */
39 PJ_ASSERT_RETURN(endpt!=NULL && count>0 && tags, PJ_EINVAL);
40 + PJ_ASSERT_RETURN(count <= PJSIP_GENERIC_ARRAY_MAX_COUNT, PJ_ETOOMANY);
41 PJ_ASSERT_RETURN(htype==PJSIP_H_ACCEPT ||
42 htype==PJSIP_H_ALLOW ||
43 htype==PJSIP_H_SUPPORTED,
44 Index: pjsip/src/pjsip-simple/evsub.c
45 ===================================================================
46 --- a/pjsip/src/pjsip-simple/evsub.c (revision 5396)
47 +++ b/pjsip/src/pjsip-simple/evsub.c (revision 5397)
51 PJ_ASSERT_RETURN(pkg_mod && event_name, PJ_EINVAL);
52 - PJ_ASSERT_RETURN(accept_cnt < PJ_ARRAY_SIZE(pkg->pkg_accept->values),
54 + /* Make sure accept_cnt < PJ_ARRAY_SIZE(pkg->pkg_accept->values) */
55 + PJ_ASSERT_RETURN(accept_cnt <= PJSIP_GENERIC_ARRAY_MAX_COUNT,
58 /* Make sure evsub module has been initialized */