Skip to content

Commit

Permalink
Check parameters passed to paircmp()
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Apr 19, 2014
1 parent 981bfc1 commit d85f368
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/valuepair.c
Expand Up @@ -2576,6 +2576,8 @@ int8_t paircmp_op(VALUE_PAIR const *a, FR_TOKEN op, VALUE_PAIR const *b)
{
int compare;

if (!a || !b) return -1;

switch (a->da->type) {
case PW_TYPE_IPADDR:
switch (b->da->type) {
Expand Down Expand Up @@ -2695,8 +2697,10 @@ int8_t paircmp(VALUE_PAIR *a, VALUE_PAIR *b)
{
int compare;

if (!a) return -1;

VERIFY_VP(a);
VERIFY_VP(b);
if (b) VERIFY_VP(b);

switch (a->op) {
case T_OP_CMP_TRUE:
Expand Down Expand Up @@ -2726,6 +2730,8 @@ int8_t paircmp(VALUE_PAIR *a, VALUE_PAIR *b)
return -1;
}

if (!b) return -1;

vp_prints_value(buffer, sizeof(buffer), b, 0);

/*
Expand Down

0 comments on commit d85f368

Please sign in to comment.