Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#2209 closed defect (fixed)

Insufficient variable storage to contain Expires header field/ parameter.

Reported by: ming Owned by: ming
Priority: normal Milestone: release-2.10
Component: pjsip Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description (last modified by ming)

RFC 3261 20.19 specifies the Expires header field to be between 0 and 232-1 seconds, but currently in sip_msg, we use the value of (signed) int. This is also applicable for Min-Expires header field, and Expires parameter of Contact header.

The following struct fields and APIs will change (all changes are from signed 32-bit integer to unsigned):

  • pjsua2:
    • AccountInfo.regExpiresSec
    • OnRegStateParam.expiration
  • pjsua:
    • pjsua_acc_info.expires
  • pjsip:
    • pjsip_contact_hdr.expires
    • pjsip_generic_int_hdr.ivalue/ pjsip_expires_hdr.ivalue/ pjsip_min_expires_hdr.ivalue/ pjsip_max_fwd_hdr.ivalue
    • pjsip_regc_info.interval
    • pjsip_regc_info.next_reg
    • pjsip_regc_cbparam.expiration
    • pjsip_generic_int_hdr_create()/ pjsip_generic_int_hdr_init()/pjsip_expires_hdr_create()/ pjsip_expires_hdr_init()/ pjsip_min_expires_hdr_create()/ pjsip_min_expires_hdr_init()/ pjsip_max_fwd_hdr_create()/ pjsip_max_fwd_hdr_init()
  • pjsip-simple:
    • pjsip_sub_state_hdr.expires_param
    • pjsip_publishc_cbparam.expiration
    • pjsip_pres_initiate()
    • pjsip_mwi_initiate()
    • pjsip_evsub_initiate()

IMPORTANT!
Backward compatibility issue:

  • Any sign comparison of the above expiration fields MUST be modified, for example: expires < 0 should be changed to expires == PJSIP_EXPIRES_NOT_SPECIFIED.
  • Direct setting/comparison with -1 should still work, for example: pjsip_pres_inititate(sub, -1, ...) or expires == -1. This is because PJSIP_EXPIRES_NOT_SPECIFIED == (unsigned) -1. Nevertheless, for future compatibility, it is recommended to change any -1 to PJSIP_EXPIRES_NOT_SPECIFIED.

Change History (4)

comment:1 Changed 5 years ago by ming

  • Owner set to ming
  • Resolution set to fixed
  • Status changed from new to closed

In 6035:

Fixed #2209: Insufficient variable storage to contain Expires header field/ parameter

comment:2 Changed 5 years ago by ming

  • Description modified (diff)

comment:3 Changed 5 years ago by ming

In 6036:

Re #2209: Fixed build failure on Android due to incompatible type

comment:4 Changed 5 years ago by ming

In 6068:

Re #2209: Add checking if expiration is specified for determining if there's an active registration

Note: See TracTickets for help on using tickets.