From 09958085c632e6a0ecdd3028808d4d80074e91fa Mon Sep 17 00:00:00 2001 From: Nathan Kidd Date: Mon, 18 Mar 2019 17:13:39 -0400 Subject: [PATCH] c_client: Fix length() for lists without fieldref The reply always has an implicit 32 bytes that are not included in the length field. --- src/c_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c_client.py b/src/c_client.py index 39f162e..ca86b05 100644 --- a/src/c_client.py +++ b/src/c_client.py @@ -1929,7 +1929,7 @@ def _c_accessors_list(self, field): # the list is directly after the fixed size part of the # request: simply subtract the size of the fixed-size part # from the request size and divide that by the member size - return '(((R->length * 4) - sizeof('+ self.c_type + '))/'+'sizeof('+field.type.member.c_wiretype+'))' + return '(((R->length * 4) + 32 - sizeof('+ self.c_type + '))/'+'sizeof('+field.type.member.c_wiretype+'))' else: # use the accessor to get the start of the list, then # compute the length of it by subtracting it from