From bf15325cd633b42b5bf5e0ed1e77beba27637811 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Thu, 10 May 2018 19:33:52 +0200 Subject: [PATCH] tests/test_nlattr.h: fix pointer calculation in TEST_NLATTR_ARRAY, take 2 The old code works only when an array contains exactly two items. * tests/test_nlattr.h (TEST_NLATTR_ARRAY): Fix pointer address for the case of incomplete read. --- tests/test_nlattr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_nlattr.h b/tests/test_nlattr.h index 84f99ba0..84125e00 100644 --- a/tests/test_nlattr.h +++ b/tests/test_nlattr.h @@ -310,7 +310,7 @@ print_nlattr(const unsigned int nla_len, const char *const nla_type) } \ printf(", ... /* %p */]}", \ RTA_DATA(TEST_NLATTR_nla) \ - + sizeof((obj_)[0]))); \ + + sizeof(obj_) - sizeof((obj_)[0]))); \ /* sizeof(obj_) */ \ TEST_NLATTR_((fd_), (nlh0_) - NLA_HDRLEN, \ (hdrlen_) + NLA_HDRLEN, \ -- 2.40.0