]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Check structure types when casting from generic to specialised
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 2 Jan 2017 02:43:01 +0000 (21:43 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 2 Jan 2017 02:43:43 +0000 (21:43 -0500)
src/include/interpreter.h

index 7386bb76c22c32b8b8b6c283231bdc1a309b2bc5..73e95cf76d3d00e558084fb90a7ff7e358aba1f9 100644 (file)
@@ -267,7 +267,7 @@ extern char const *const comp2str[];
 static inline unlang_module_call_t *unlang_generic_to_module_call(unlang_t *p)
 {
        rad_assert(p->type == UNLANG_TYPE_MODULE_CALL);
-       return (unlang_module_call_t *)p;
+       return talloc_get_type_abort(p, unlang_module_call_t);
 }
 
 static inline unlang_group_t *unlang_group_to_module_call(unlang_t *p)
@@ -290,7 +290,7 @@ static inline unlang_t *unlang_group_to_generic(unlang_group_t *p)
 static inline unlang_xlat_inline_t *unlang_generic_to_xlat_inline(unlang_t *p)
 {
        rad_assert(p->type == UNLANG_TYPE_XLAT_INLINE);
-       return (unlang_xlat_inline_t *)p;
+       return talloc_get_type_abort(p, unlang_xlat_inline_t);
 }
 
 static inline unlang_t *unlang_xlat_inline_to_generic(unlang_xlat_inline_t *p)
@@ -301,7 +301,7 @@ static inline unlang_t *unlang_xlat_inline_to_generic(unlang_xlat_inline_t *p)
 static inline unlang_resumption_t *unlang_generic_to_resumption(unlang_t *p)
 {
        rad_assert(p->type == UNLANG_TYPE_RESUME);
-       return (unlang_resumption_t *)p;
+       return talloc_get_type_abort(p, unlang_resumption_t);
 }
 
 static inline unlang_t *unlang_resumption_to_generic(unlang_resumption_t *p)