summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2016-04-04 11:09:00 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2016-04-05 08:55:34 +0200
commit1d88a271a69119635158bdc4009c38fbc4199997 (patch)
tree6d67e9518598fbd94639e169cfad0bed56a31577 /src/libsystemd-network
parent77384fb0edda2e9d826c1e6786faae607b48e47d (diff)
sd-device: fix crash if a device has many tags or devlinks
strjoina() is unsafe to be used in an unbounded loop as alloca() has no error reporting. Thus devices with a large number of tags or devlinks trigger a segfault in device_properties_prepare() due to overflowing the stack. Rewrite the building of the "tags" and "devlinks" strings using GREEDY_REALLOC() and strpcpy() to work with arbitrarily long strings. This also avoids re-copying the entire string in each loop iteration. Before this commit we always appended one final ":" to "tags". Change this to start with an iniital ":" and for each tag append instead of prepend a ":". This unifies what happens for the first and all subsequent tags so that we can use a for loop. Fixes #2954
Diffstat (limited to 'src/libsystemd-network')
0 files changed, 0 insertions, 0 deletions