]> xenbits.xensource.com Git - libvirt.git/commit
conf: Rework <tpm/> formatting
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 4 Jan 2022 07:24:25 +0000 (08:24 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 4 Jan 2022 08:59:10 +0000 (09:59 +0100)
commit5e2a368c618d645a0bc08f172052a410ff2d56ca
tree90b037a4df207de9ccae3d8b06678fe84ad12bc3
parentd00e6dfe6bb01f03df0efe7aee0ffdec6b21a59e
conf: Rework <tpm/> formatting

The <tpm/> element formatting is handled in
virDomainTPMDefFormat() which uses the "old style" - appending
strings directly into the output buffer. With this, it's easy to
get conditions that tell when an element has ended wrong. In this
particular case, if both <encryption/> and <active_pcr_banks/>
are to be formatted the current code puts a stray '>' into the
output buffer, resulting in invalid XML.

Rewrite the function to use virXMLFormatElement() which is more
clever.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2016599#c15
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/domain_conf.c