Browse Source

ENGINE-843: bad input checking everywhere

ENGINE-872
parent
commit
5fce011baf
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      src/stringpair.c

+ 12
- 0
src/stringpair.c View File

@ -118,6 +118,9 @@ DYNAMIC_API stringpair_list_t *stringpair_list_add(
{
assert(value);
if (!value)
return NULL;
// empty list (no nodes)
if (stringpair_list == NULL)
return new_stringpair_list(value);
@ -182,6 +185,9 @@ DYNAMIC_API int stringpair_list_length(
const stringpair_list_t *stringpair_list
)
{
if (!stringpair_list)
return 0;
int len = 0;
for (const stringpair_list_t *_sl = stringpair_list; _sl && _sl->value; _sl = _sl->next)
@ -208,6 +214,9 @@ DYNAMIC_API stringpair_list_t *stringpair_list_delete_by_key(
assert(sp_list);
assert(key);
if (!key || !sp_list)
return NULL;
if (sp_list->value == NULL) {
free_stringpair_list(sp_list);
return NULL;
@ -241,6 +250,9 @@ DYNAMIC_API stringpair_list_t *stringpair_list_find(
{
assert(key);
if (!key || !stringpair_list || !stringpair_list->value)
return NULL;
for (stringpair_list_t *_l = stringpair_list; _l; _l = _l->next) {
if (strcoll(key, _l->value->key) == 0)
return _l;


Loading…
Cancel
Save