From bf7fefdc32dbf07aef1c4b1bc221a2c963a38ace Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 4 Jan 2017 14:09:20 +1030 Subject: [PATCH] generate-wire.py: add memcheck() to towire functions. Sanity check that we're not streaming uninitialized bytes. Signed-off-by: Rusty Russell --- tools/generate-wire.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/generate-wire.py b/tools/generate-wire.py index a240c22a9..e2f8ff85b 100755 --- a/tools/generate-wire.py +++ b/tools/generate-wire.py @@ -251,8 +251,9 @@ class Message(object): print('\ttowire_{}(&p, {});' .format(basetype, f.name)) + # Make sure we haven't encoded any uninitialzied fields! print('\n' - '\treturn p;\n' + '\treturn memcheck(p, tal_count(p));\n' '}\n') parser = OptionParser() @@ -274,6 +275,7 @@ if options.output_header: ''.format(idem)) else: print('#include <{}>\n' + '#include \n' ''.format(args[0])) # Maps message names to messages