mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-01 03:27:59 +02:00
brei: silence warnings on 32-bit architectures
src/brei-shared.c:231:16: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
if (end - p < len32) {
~~~~~~~ ^ ~~~~~
src/brei-shared.c:233:76: warning: format specifies type 'long' but the argument has type 'int' [-Wformat]
"Invalid string length %u, only %li bytes remaining", s->len, (end - p) * 4);
~~~ ^~~~~~~~~~~~~
%i
Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
cf932d1efb
commit
e27f039b32
1 changed files with 3 additions and 2 deletions
|
|
@ -225,12 +225,13 @@ brei_demarshal(struct brei_context *brei, struct iobuf *buf, const char *signatu
|
|||
case 's': {
|
||||
struct brei_string *s = (struct brei_string *)p;
|
||||
|
||||
uint32_t remaining = end - p;
|
||||
uint32_t protolen = brei_string_proto_length(s->len); /* in bytes */
|
||||
uint32_t len32 = protolen/4; /* p and end are uint32_t* */
|
||||
|
||||
if (end - p < len32) {
|
||||
if (remaining < len32) {
|
||||
return brei_result_new(BREI_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
||||
"Invalid string length %u, only %li bytes remaining", s->len, (end - p) * 4);
|
||||
"Invalid string length %u, only %u bytes remaining", s->len, remaining * 4);
|
||||
}
|
||||
|
||||
if (s->len == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue