From 327dd4f8b167910ea91b8c36a656cd9e80bf54d2 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 3 Dec 2024 13:05:43 +1000 Subject: [PATCH] test: fix string encoding in the python test bindings The protocol encoding is the string including the null byte. The test wrappers sent the right string length but only encoded strlen() bytes so where we had a string that's a multiple of 4 long we ended up claiming it's a byte longer than was on the wire. Part-of: --- test/eiproto.py.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/eiproto.py.tmpl b/test/eiproto.py.tmpl index 9769e07..33fbbbf 100644 --- a/test/eiproto.py.tmpl +++ b/test/eiproto.py.tmpl @@ -174,7 +174,7 @@ class Interface: elif sig in ["s"]: encoding.append("I") arguments.append(len(arg) + 1) - slen = ((len(arg) + 3) // 4) * 4 + slen = ((len(arg) + 1 + 3) // 4) * 4 encoding.append(f"{slen}s") arg = arg.encode("utf8") elif sig in ["h"]: