HomeClusterLabs Projects

Fix: libcrmcommon: Prevent buffer overflow in pcmk__element_xpath()

Description

Fix: libcrmcommon: Prevent buffer overflow in pcmk__element_xpath()

Use GString instead of snprintf() with a buffer and offset, so that we
can easily and dynamically grow to meet our string size needs.

When a string is only used or tracing, do not build the string unless
tracing is enabled. We want to avoid the overhead. See the
pcmk__log_else() calls.

Ref T152
Resolves RHBZ#1822125

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>

Details

Provenance
nrwahl2Authored on Sep 8 2022, 4:12 AM
root <root@boomstick.rhts.eng.bos.redhat.com>Committed on Sep 19 2022, 3:53 PM
Parents
rP13e531eaa0b8: Refactor: libcrmcommon: Remove redundant arg from pcmk__element_xpath()
Branches
Unknown
Tags
Unknown
Tasks
Restricted Maniphest Task