HomeClusterLabs Projects

Low: libcrmcommon: handle invalid match in pcmk__replace_submatches()

Description

Low: libcrmcommon: handle invalid match in pcmk__replace_submatches()

If the match argument is empty, and the nmatches argument is set correctly (it
must be 0 in that case), then we could never have a problem because the first
pass through process_submatches() would determine that nothing needs to be
replaced.

We can't really tell if someone passed invalid submatches or nmatches
arguments, but we can short-circuit if the match argument is empty, to avoid
any problem if an empty match is mistakenly passed along with non-empty
submatches (which, as coverity complains, would result in an invalid memory
offset).

Details

Provenance
kgaillotAuthored on Mar 20 2024, 1:21 PM
Parents
rPf23181a89f90: Refactor: libcrmcommon: make some rule functions library-private
Branches
Unknown
Tags
Unknown