1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-24 15:28:10 +00:00

fix(legacy): Fix compile-time check of maximum protobuf message size.

This commit is contained in:
Andrew Kozlik 2021-10-18 12:12:54 +02:00 committed by Andrew Kozlik
parent dfd98c5164
commit 926365b64e
3 changed files with 3 additions and 2 deletions

View File

@ -0,0 +1 @@
Fix incorrect compile-time check of maximum protobuf message size.

View File

@ -29,7 +29,7 @@
#define MSG_HEADER_SIZE 9 #define MSG_HEADER_SIZE 9
// Maximum size of an incoming protobuf-encoded message without headers. // Maximum size of an incoming protobuf-encoded message without headers.
#define MSG_IN_ENCODED_SIZE (15 * 1024) #define MSG_IN_ENCODED_SIZE (16 * 1024)
// Maximum size of a C struct containing a decoded incoming message. // Maximum size of a C struct containing a decoded incoming message.
#define MSG_IN_DECODED_SIZE (15 * 1024) #define MSG_IN_DECODED_SIZE (15 * 1024)

View File

@ -97,7 +97,7 @@ def handle_message(fh, fl, skipped, message):
if encoded_size: if encoded_size:
fl.write( fl.write(
f'_Static_assert({encoded_size} >= sizeof({short_name}_size), "msg buffer too small");\n' f'_Static_assert({encoded_size} >= {short_name}_size, "msg buffer too small");\n'
) )
if decoded_size: if decoded_size: