HomeClusterLabs Projects

High: tools: Fix a segfault in error handling in crm_resource.

Description

High: tools: Fix a segfault in error handling in crm_resource.

First, we need to allocate the right amount of memory for printing error
messages. Add space for the initial "non-option..." string and another
space for the NULL terminator on a string vector.

I think what happened here is that the "non-option..." string is not
terminated with a newline, making it appear as if it is the same string
as the first extra command line parameter string. However, it does
actually take up its own slot in the string vector and so needs a slot
allocated for it.

So while I'm at it, add the newline back in. It appears to have been
incorrectly removed when crm_resource was converted to using GError
instead of CMD_ERR.

Fixes T522
See: clbz#5496

Details

Provenance
clumensAuthored on Jul 18 2022, 1:55 PM
Parents
rP667358083663: Merge pull request #2765 from clumens/fence-helper-glib
Branches
Unknown
Tags
Unknown
Tasks
Restricted Maniphest Task