]> git.ipfire.org Git - thirdparty/qemu.git/commit
nbd: Avoid off-by-one in long export name truncation
authorEric Blake <eblake@redhat.com>
Mon, 22 Jun 2020 21:03:55 +0000 (16:03 -0500)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 3 Sep 2020 00:06:19 +0000 (19:06 -0500)
commit9380cb9de20b1554162eea9eb0e80209464ace50
tree9a906d77c587af1021b211f0c8f2915b528036b3
parentb3e49baa79908d7e1c35df3814435dda72d85267
nbd: Avoid off-by-one in long export name truncation

When snprintf returns the same value as the buffer size, the final
byte was truncated to ensure a NUL terminator.  Fortunately, such long
export names are unusual enough, with no real impact other than what
is displayed to the user.

Fixes: 5c86bdf12089
Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200622210355.414941-1-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
(cherry picked from commit 00d69986da83a74f6f5731c80f8dd09fde95d19a)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/nbd.c