]> xenbits.xensource.com Git - libvirt.git/commit
apparmor: avoid copying empty profile name
authorJim Fehlig <jfehlig@suse.com>
Mon, 9 Sep 2019 15:50:39 +0000 (09:50 -0600)
committerJim Fehlig <jfehlig@suse.com>
Fri, 13 Sep 2019 18:26:51 +0000 (12:26 -0600)
commit281a7f1d400aeb0d4d53dd3b628b7275f49854d0
tree73548e975e0794e7cb9d69004b5ec22fd99315a9
parentd6b144b1fe3024f1f116de41a0274f0f5ced39de
apparmor: avoid copying empty profile name

AppArmorGetSecurityProcessLabel copies the VM's profile name to the
label member of virSecurityLabel struct. If the profile is not loaded,
the name is set empty before calling virStrcpy to copy it. However,
virStrcpy will fail if src is empty (0 length), causing
AppArmorGetSecurityProcessLabel to needlessly fail. Simple operations
that report security driver information will subsequently fail

virsh dominfo test
Id:             248
Name:           test
...
Security model: apparmor
Security DOI:   0
error: internal error: error copying profile name

Avoid copying an empty profile name when the profile is not loaded.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/security/security_apparmor.c