Module: kamailio Branch: 5.2 Commit: 3226ccb44ba6becfffe8ba36464a7756ceb03342 URL: https://github.com/kamailio/kamailio/commit/3226ccb44ba6becfffe8ba36464a7756ceb03342
Author: Daniel-Constantin Mierla <[email protected]> Committer: Henning Westerholt <[email protected]> Date: 2019-04-11T21:54:52+02:00 core: parse - validity check for contact uri size and more verbose log message (cherry picked from commit 69f9b0a4d5261ec5b6d8d7163b3809a9bb24916d) --- Modified: src/core/parser/contact/contact.c --- Diff: https://github.com/kamailio/kamailio/commit/3226ccb44ba6becfffe8ba36464a7756ceb03342.diff Patch: https://github.com/kamailio/kamailio/commit/3226ccb44ba6becfffe8ba36464a7756ceb03342.patch --- diff --git a/src/core/parser/contact/contact.c b/src/core/parser/contact/contact.c index 4c534ece77..c87e329864 100644 --- a/src/core/parser/contact/contact.c +++ b/src/core/parser/contact/contact.c @@ -182,6 +182,9 @@ int parse_contacts(str* _s, contact_t** _c) { contact_t* c; param_hooks_t hooks; + str sv; + + sv = *_s; while(1) { /* Allocate and clear contact structure */ @@ -220,6 +223,10 @@ int parse_contacts(str* _s, contact_t** _c) } trim(&c->uri); + if((c->uri.len <= 0) || (c->uri.s + c->uri.len > sv.s + sv.len)) { + LM_ERR("invlid contact uri\n"); + goto error; + } if (_s->len == 0) goto ok; @@ -264,6 +271,8 @@ int parse_contacts(str* _s, contact_t** _c) } error: + LM_ERR("failure parsing '%.*s' (%d) [%p/%p/%d]\n", sv.len, sv.s, sv.len, + sv.s, _s->s, (int)(_s->s - sv.s)); if (c) pkg_free(c); free_contacts(_c); /* Free any contacts created so far */ return -1; _______________________________________________ Kamailio (SER) - Development Mailing List [email protected] https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
