]> xenbits.xensource.com Git - libvirt.git/commit
storagefile: Fix backing format \0 check
authorCole Robinson <crobinso@redhat.com>
Fri, 4 Oct 2019 23:41:36 +0000 (19:41 -0400)
committerCole Robinson <crobinso@redhat.com>
Fri, 11 Oct 2019 18:25:53 +0000 (14:25 -0400)
commit9f0d3647553cdc3557600a9e10856f20004cff99
treee1a977f43405a9b093a46b3d9c7972892a8f59a2
parentc87784be89343642bda6c3020362173b0936b2da
storagefile: Fix backing format \0 check

From qemu.git docs/interop/qcow2.txt

  == String header extensions ==

  Some header extensions (such as the backing file format name and
  the external data file name) are just a single string. In this case,
  the header extension length is the string length and the string is
  not '\0' terminated. (The header extension padding can make it look
  like a string is '\0' terminated, but neither is padding always
  necessary nor is there a guarantee that zero bytes are used
  for padding.)

So we shouldn't be checking for a \0 byte at the end of the backing
format section. I think in practice there always is a \0 but we
shouldn't depend on that.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
src/util/virstoragefile.c