sd-resolve: fix check for packet size
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 14 May 2018 14:59:20 +0000 (16:59 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 15 May 2018 10:31:42 +0000 (12:31 +0200)
commit38dad4433295d583343b82aac87326d407fe2927
tree41254da884421d78c0b2792890a7aab66f58cbc7
parent2da063370acdb83a408095431a3a7d124f4ea5dc
sd-resolve: fix check for packet size

The protocol is that a string is serialized with the nul byte at the end, and
the terminator is included in length. We'd call strndup with offset 0, length
len1-1, and then a second time with offset len1, length len2-1, so in the end
the check was off by one. But let's require the terminating nul too, even if
we don't access it.

CID #1383035.
src/libsystemd/sd-resolve/sd-resolve.c