Module: kamailio
Branch: master
Commit: d22d812da1c3b2a2f65f142ef5ed5fa07e8ab072
URL:
https://github.com/kamailio/kamailio/commit/d22d812da1c3b2a2f65f142ef5ed5fa…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-05-13T17:41:40+02:00
core: xavp - safety checks for name len
---
Modified: src/core/xavp.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d22d812da1c3b2a2f65f142ef5ed5fa…
Patch:
https://github.com/kamailio/kamailio/commit/d22d812da1c3b2a2f65f142ef5ed5fa…
---
diff --git a/src/core/xavp.c b/src/core/xavp.c
index b11b99929d..036a5ffbe1 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;
}
@@ -1579,7 +1579,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);
@@ -1812,7 +1812,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);
@@ -1939,7 +1939,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);
@@ -2022,7 +2022,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);
@@ -2315,7 +2315,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) {