Module: kamailio
Branch: 5.4
Commit: dd09c233417129694ffb7481b03d465defae447d
URL:
https://github.com/kamailio/kamailio/commit/dd09c233417129694ffb7481b03d465…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-05-26T08:29:04+02:00
core: xavp - safety checks for name len
(cherry picked from commit d22d812da1c3b2a2f65f142ef5ed5fa07e8ab072)
(cherry picked from commit 6a5a61bfab80116338f6a9c91ed7ec5f7b98923b)
---
Modified: src/core/xavp.c
---
Diff:
https://github.com/kamailio/kamailio/commit/dd09c233417129694ffb7481b03d465…
Patch:
https://github.com/kamailio/kamailio/commit/dd09c233417129694ffb7481b03d465…
---
diff --git a/src/core/xavp.c b/src/core/xavp.c
index e27c07bd6f..5f160a1ceb 100644
--- a/src/core/xavp.c
+++ b/src/core/xavp.c
@@ -106,7 +106,7 @@ static sr_xavp_t *xavp_new_value(str *name, sr_xval_t *val)
int size;
unsigned int id;
- if(name==NULL || name->s==NULL || val==NULL)
+ if(name==NULL || name->s==NULL || name->len<=0 || val==NULL)
return NULL;
id = get_hash1_raw(name->s, name->len);
@@ -427,7 +427,7 @@ static int xavp_rm_internal(str *name, sr_xavp_t **head, int idx)
int n=0;
int count=0;
- if(name==NULL || name->s==NULL)
+ if(name==NULL || name->s==NULL || name->len<=0)
return 0;
id = get_hash1_raw(name->s, name->len);
@@ -498,7 +498,7 @@ int xavp_count(str *name, sr_xavp_t **start)
unsigned int id;
int n = 0;
- if(name==NULL || name->s==NULL)
+ if(name==NULL || name->s==NULL || name->len<=0)
return -1;
id = get_hash1_raw(name->s, name->len);
@@ -865,7 +865,7 @@ sr_xavp_t *xavp_extract(str *name, sr_xavp_t **list)
sr_xavp_t *prv = 0;
unsigned int id;
- if(name==NULL || name->s==NULL) {
+ if(name==NULL || name->s==NULL || name->len<=0) {
if(list!=NULL) {
avp = *list;
if(avp!=NULL) {
@@ -1157,7 +1157,7 @@ static sr_xavp_t *xavu_get_internal(str *name, sr_xavp_t **list,
sr_xavp_t **prv
sr_xavp_t *avu;
unsigned int id;
- if(name==NULL || name->s==NULL) {
+ if(name==NULL || name->s==NULL || name->len<=0) {
return NULL;
}
@@ -1235,7 +1235,7 @@ int xavu_rm_by_name(str *name, sr_xavp_t **head)
unsigned int id;
- if(name==NULL || name->s==NULL) {
+ if(name==NULL || name->s==NULL || name->len<=0) {
return -1;
}
@@ -1466,7 +1466,7 @@ static sr_xavp_t *xavi_new_value(str *name, sr_xval_t *val)
int size;
unsigned int id;
- if(name==NULL || name->s==NULL || val==NULL)
+ if(name==NULL || name->s==NULL || name->len<=0 || val==NULL)
return NULL;
id = get_hash1_case_raw(name->s, name->len);
@@ -1699,7 +1699,7 @@ static sr_xavp_t *xavi_get_internal(str *name, sr_xavp_t **list, int
idx, sr_xav
unsigned int id;
int n = 0;
- if(name==NULL || name->s==NULL)
+ if(name==NULL || name->s==NULL || name->len<=0)
return NULL;
id = get_hash1_case_raw(name->s, name->len);
@@ -1826,7 +1826,7 @@ static int xavi_rm_internal(str *name, sr_xavp_t **head, int idx)
int n=0;
int count=0;
- if(name==NULL || name->s==NULL)
+ if(name==NULL || name->s==NULL || name->len<=0)
return 0;
id = get_hash1_case_raw(name->s, name->len);
@@ -1909,7 +1909,7 @@ int xavi_count(str *name, sr_xavp_t **start)
unsigned int id;
int n = 0;
- if(name==NULL || name->s==NULL)
+ if(name==NULL || name->s==NULL || name->len<=0)
return -1;
id = get_hash1_case_raw(name->s, name->len);
@@ -2202,7 +2202,7 @@ sr_xavp_t *xavi_extract(str *name, sr_xavp_t **list)
sr_xavp_t *prv = 0;
unsigned int id;
- if(name==NULL || name->s==NULL) {
+ if(name==NULL || name->s==NULL || name->len<=0) {
if(list!=NULL) {
avi = *list;
if(avi!=NULL) {