diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-11-10 05:09:44 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-11-10 05:09:44 +0000 |
commit | b3be2389bab918b534f75b7a6b516d037971ec26 (patch) | |
tree | 0687da3e2bc8aa24ced5974bf8bbd66790553519 /pjsip/src | |
parent | 36e57709b519648f8a29ad13b9709b6c96b5d6ca (diff) |
More ticket #940: Multiple header rows with the same name may not be completely processed by PJSIP modules:
- handle the case when context doesn't have rdata (such as when parsing individual header or in pjsip-test), which crashed the app
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3003 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src')
-rw-r--r-- | pjsip/src/pjsip/sip_parser.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/pjsip/src/pjsip/sip_parser.c b/pjsip/src/pjsip/sip_parser.c index 5f004ca1..ac8200cb 100644 --- a/pjsip/src/pjsip/sip_parser.c +++ b/pjsip/src/pjsip/sip_parser.c @@ -1932,13 +1932,15 @@ static pjsip_hdr* parse_hdr_from( pjsip_parse_ctx *ctx ) static pjsip_hdr* parse_hdr_require( pjsip_parse_ctx *ctx ) { pjsip_require_hdr *hdr; - pj_bool_t new_hdr = (ctx->rdata->msg_info.require == NULL); + pj_bool_t new_hdr = (ctx->rdata==NULL || + ctx->rdata->msg_info.require == NULL); if (ctx->rdata && ctx->rdata->msg_info.require) { hdr = ctx->rdata->msg_info.require; } else { hdr = pjsip_require_hdr_create(ctx->pool); - ctx->rdata->msg_info.require = hdr; + if (ctx->rdata) + ctx->rdata->msg_info.require = hdr; } parse_generic_array_hdr(hdr, ctx->scanner); @@ -1981,13 +1983,15 @@ static pjsip_hdr* parse_hdr_retry_after(pjsip_parse_ctx *ctx) static pjsip_hdr* parse_hdr_supported(pjsip_parse_ctx *ctx) { pjsip_supported_hdr *hdr; - pj_bool_t new_hdr = (ctx->rdata->msg_info.supported == NULL); + pj_bool_t new_hdr = (ctx->rdata==NULL || + ctx->rdata->msg_info.supported == NULL); if (ctx->rdata && ctx->rdata->msg_info.supported) { hdr = ctx->rdata->msg_info.supported; } else { hdr = pjsip_supported_hdr_create(ctx->pool); - ctx->rdata->msg_info.supported = hdr; + if (ctx->rdata) + ctx->rdata->msg_info.supported = hdr; } parse_generic_array_hdr(hdr, ctx->scanner); |