From: Arran Cudbard-Bell Date: Fri, 19 Jul 2019 23:53:06 +0000 (+0900) Subject: Pass in _vpt X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec790128b9dea226341a22e5efaa0469998bae03;p=thirdparty%2Ffreeradius-server.git Pass in _vpt --- diff --git a/src/lib/server/tmpl.c b/src/lib/server/tmpl.c index 7c314ddbb94..bc20cf12741 100644 --- a/src/lib/server/tmpl.c +++ b/src/lib/server/tmpl.c @@ -2566,7 +2566,7 @@ static uint8_t const *not_zeroed(uint8_t const *ptr, size_t len) return NULL; } -#define CHECK_ZEROED(_x) not_zeroed(((uint8_t const *)&vpt->data) + sizeof(_x), sizeof(vpt->data) - sizeof(_x)) +#define CHECK_ZEROED(_vpt, _x) not_zeroed(((uint8_t const *)&(_vpt)->data) + sizeof(_x), sizeof((_vpt)->data) - sizeof(_x)) /** Verify fields of a vp_tmpl_t make sense * @@ -2645,7 +2645,7 @@ void tmpl_verify(char const *file, int line, vp_tmpl_t const *vpt) break; case TMPL_TYPE_XLAT_STRUCT: - if (CHECK_ZEROED(vpt->data.xlat)) { + if (CHECK_ZEROED(vpt, vpt->data.xlat)) { FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_XLAT_STRUCT " "has non-zero bytes after the data.xlat pointer in the union", file, line); if (!fr_cond_assert(0)) fr_exit_now(1); @@ -2666,7 +2666,7 @@ void tmpl_verify(char const *file, int line, vp_tmpl_t const *vpt) break; case TMPL_TYPE_ATTR: - if (CHECK_ZEROED(vpt->data.attribute)) { + if (CHECK_ZEROED(vpt, vpt->data.attribute)) { FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_ATTR " "has non-zero bytes after the data.attribute struct in the union", file, line); @@ -2759,7 +2759,7 @@ void tmpl_verify(char const *file, int line, vp_tmpl_t const *vpt) break; case TMPL_TYPE_LIST: - if (CHECK_ZEROED(vpt->data.attribute)) { + if (CHECK_ZEROED(vpt, vpt->data.attribute)) { FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_LIST" "has non-zero bytes after the data.attribute struct in the union", file, line); if (!fr_cond_assert(0)) fr_exit_now(1); @@ -2773,7 +2773,7 @@ void tmpl_verify(char const *file, int line, vp_tmpl_t const *vpt) break; case TMPL_TYPE_DATA: - if (CHECK_ZEROED(vpt->data.literal)) { + if (CHECK_ZEROED(vpt, vpt->data.literal)) { FR_FAULT_LOG("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_DATA " "has non-zero bytes after the data.literal struct in the union", file, line);