Skip to content

Commit

Permalink
Add some more asserts for catching invalid VPs when build without WIT…
Browse files Browse the repository at this point in the history
…H_VERIFY_PTR
  • Loading branch information
arr2036 committed May 28, 2014
1 parent a73a7c2 commit 7c6ce4f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/include/libradius.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,18 @@ extern "C" {
* Add if (_x->da) (void) talloc_get_type_abort(_x->da, DICT_ATTR);
* to the macro below when dictionaries are talloced.
*/
# define VERIFY_VP(_x) fr_verify_vp(_x)
# define VERIFY_LIST(_x) fr_verify_list(NULL, _x)
# define VERIFY_PACKET(_x) (void) talloc_get_type_abort(_x, RADIUS_PACKET)
# define VERIFY_VP(_x) fr_verify_vp(_x)
# define VERIFY_LIST(_x) fr_verify_list(NULL, _x)
# define VERIFY_PACKET(_x) (void) talloc_get_type_abort(_x, RADIUS_PACKET)
#else
# define VERIFY_VP(_x)
# define VERIFY_LIST(_x)
# define VERIFY_PACKET(_x)
/*
* Even if were building without WITH_VERIFY_PTR
* the pointer must not be NULL when these various macros are used
* so we can add some sneaky soft asserts.
*/
# define VERIFY_VP(_x) fr_assert(_x)
# define VERIFY_LIST(_x) fr_assert(_x)
# define VERIFY_PACKET(_x) fr_assert(_x)
#endif

#define AUTH_VECTOR_LEN 16
Expand Down
1 change: 1 addition & 0 deletions src/main/valuepair.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@ int radius_map2request(REQUEST *request, value_pair_map_t const *map,
}

parent = radius_list_ctx(context, map->dst->vpt_list);
rad_assert(parent);

/*
* The callback should either return -1 to signify operations error,
Expand Down

0 comments on commit 7c6ce4f

Please sign in to comment.