bus-message: avoid wrap-around when using length read from message
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 23 Aug 2018 12:48:40 +0000 (14:48 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 2 Oct 2018 09:59:08 +0000 (11:59 +0200)
commit902000c19830f5e5a96e8948d691b42e91ecb1e7
tree98cfc501ff2a8ad2937663cee1831186b7361f93
parentd831fb6f2bde829f9309aea242f502587662d1cc
bus-message: avoid wrap-around when using length read from message

We would read (-1), and then add 1 to it, call message_peek_body(..., 0, ...),
and when trying to make use of the data.

The fuzzer test case is just for one site, but they all look similar.

v2: fix two UINT8_MAX/UINT32_MAX mismatches founds by LGTM
src/libsystemd/sd-bus/bus-message.c
test/fuzz/fuzz-bus-message/crash-603dfd98252375ac7dbced53c2ec312671939a36 [new file with mode: 0644]