nbd/server: Reject embedded NUL in NBD strings
commitd1e2c3e7bd22a99660b0c254fc05c020d0239ca0
authorEric Blake <eblake@redhat.com>
Wed, 30 Sep 2020 12:11:02 +0000 (30 07:11 -0500)
committerEric Blake <eblake@redhat.com>
Fri, 9 Oct 2020 20:05:08 +0000 (9 15:05 -0500)
treed4c7023f6fba436fa5704074ce808c8f64d04cb1
parent029a88c9a7e3210ba565c081471bd44ba8d5e397
nbd/server: Reject embedded NUL in NBD strings

The NBD spec is clear that any string sent from the client must not
contain embedded NUL characters.  If the client passes "a\0", we
should reject that option request rather than act on "a".

Testing this is not possible with a compliant client, but I was able
to use gdb to coerce libnbd into temporarily behaving as such a
client.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200930121105.667049-3-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
nbd/server.c