]> git.ipfire.org Git - thirdparty/libvirt.git/commit
lxc: Fix segfault when lxc.network does not start with 'type'
authorJulio Faracco <jcfaracco@gmail.com>
Thu, 6 Feb 2020 02:12:05 +0000 (23:12 -0300)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 6 Feb 2020 13:57:17 +0000 (14:57 +0100)
commit991c56105d6e06deed2ab0505cdcd678cea64ef3
tree5a0ff6cc3dbd2506daa7be71ebb78cc1324057eb
parent933ad860029990449d30018486b58e9b95edff70
lxc: Fix segfault when lxc.network does not start with 'type'

To configure network settings using config file, legacy LXC settings
require starting them with 'lxc.network.type' entry. If someone
accidentally starts with 'lxc.network.name', libvirt will crash with
segfault. This patch checks if this case is happening.

Sample invalid settings:
lxc.network.link = eth0
lxc.network.type = phys
lxc.network.name = eth1
lxc.network.ipv4 = 192.168.122.2/24
lxc.network.ipv4.gateway = 192.168.122.1

Now, libvirt only see error without segmentation fault.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/lxc/lxc_native.c