]> git.ipfire.org Git - thirdparty/systemd.git/commit
networkd: fix memory corruption 7714/head
authorLennart Poettering <lennart@poettering.net>
Thu, 4 Jan 2018 10:36:58 +0000 (11:36 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 5 Jan 2018 12:59:12 +0000 (13:59 +0100)
commitf3c33b234d9f0256805722f02c7b4c4b59fd6de6
tree4b7b55a68413f59b53efc10528db94d992e7db42
parent2ac0ab5921a3153e0334b4342554fc0c87ab01c3
networkd: fix memory corruption

When loading .netdev files we parse them twice: first we do one parsing
iteration to figure out their "kind", and then we do it again to parse
out the kind's parameters. The first iteration is run with a "short"
NetDev structure, that only covers the generic NetDev properties. Which
should be enough, as we don't parse the per-kind properties. However,
before this patch we'd still try to destruct the per-kind properties
which resulted in memory corruption. With this change we distuingish the
two iterations by the state field, so that the destruction only happens
when the state signals we are running with a full NetDev structure.

Since this is not obvious, let's add a lot of comments.
src/network/netdev/netdev.c
src/network/netdev/netdev.h