Module: kamailio
Branch: master
Commit: e802f9187383feb7fdd96c4ded44fda403da4535
URL:
https://github.com/kamailio/kamailio/commit/e802f9187383feb7fdd96c4ded44fda…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-10-11T12:37:08+02:00
core: parser sdp - check field length when extracting the value
---
Modified: src/core/parser/sdp/sdp_helpr_funcs.c
---
Diff:
https://github.com/kamailio/kamailio/commit/e802f9187383feb7fdd96c4ded44fda…
Patch:
https://github.com/kamailio/kamailio/commit/e802f9187383feb7fdd96c4ded44fda…
---
diff --git a/src/core/parser/sdp/sdp_helpr_funcs.c
b/src/core/parser/sdp/sdp_helpr_funcs.c
index a5186fb4428..079a9992402 100644
--- a/src/core/parser/sdp/sdp_helpr_funcs.c
+++ b/src/core/parser/sdp/sdp_helpr_funcs.c
@@ -346,13 +346,16 @@ int extract_candidate(str *body, sdp_stream_cell_t *stream)
}
-/* generic method for attribute extraction
+/* generic method for attribute value extraction
* field must has format "a=attrname:" */
int extract_field(str *body, str *value, str field)
{
- if(strncmp(body->s, field.s, field.len < body->len ? field.len : body->len)
- != 0) {
- /*LM_DBG("We are not pointing to an %.* attribute =>`%.*s'\n",
field.len, field.s, body->len, body->s); */
+ if(body->len < field.len) {
+ return -1;
+ }
+ if(strncmp(body->s, field.s, field.len) != 0) {
+ /* LM_DBG("We are not pointing to an %.* attribute =>`%.*s'\n",
+ field.len, field.s, body->len, body->s); */
return -1;
}