mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-11 09:04:21 +01:00
common: fix gcc-12.3.0 -O3 warning.
This is actually a valid complaint (though this is a sanity check for
things we make ourselves, still!).
```
In file included from common/test/run-blindedpath_onion.c:9:
common/test/../sphinx.c: In function ‘sphinx_add_hop_has_length’:
common/test/../sphinx.c:117:12: error: ‘prepended_len’ may be used uninitialized [-Werror=maybe-uninitialized]
117 | if (lenlen + prepended_len != tal_bytelen(payload))
| ^
common/test/../sphinx.c:109:27: note: ‘prepended_len’ was declared here
109 | bigsize_t lenlen, prepended_len;
| ^~~~~~~~~~~~~
cc1: all warnings being treated as errors
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -108,9 +108,8 @@ bool sphinx_add_hop_has_length(struct sphinx_path *path, const struct pubkey *pu
|
||||
struct sphinx_hop sp;
|
||||
bigsize_t lenlen, prepended_len;
|
||||
|
||||
/* You promised size was prepended! */
|
||||
if (tal_bytelen(payload) == 0)
|
||||
return false;
|
||||
/* In case length is missing, we'll return false. */
|
||||
prepended_len = UINT64_MAX;
|
||||
lenlen = bigsize_get(payload, tal_bytelen(payload), &prepended_len);
|
||||
if (add_overflows_u64(lenlen, prepended_len))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user