mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-24 23:38:09 +00:00
fix(legacy): Fix compile-time check of maximum protobuf message size.
This commit is contained in:
parent
dfd98c5164
commit
926365b64e
1
legacy/firmware/.changelog.d/1854.fixed
Normal file
1
legacy/firmware/.changelog.d/1854.fixed
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix incorrect compile-time check of maximum protobuf message size.
|
@ -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)
|
||||||
|
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user