HomeClusterLabs Projects

Low: attrd: Ensure set ID is non-empty

Description

Low: attrd: Ensure set ID is non-empty

Previously, if attr->set_id were the empty string, attrd_set_id() would
pass a copy to crm_xml_sanitize_id(). In that case, there's nothing to
sanitize and thus no way for crm_xml_sanitize_id() to turn its argument
into a valid XML ID (other than performing a realloc() and storing
arbitrary charactrs).

It's better to treat an empty attr->set_id the same as a NULL one, and
use the default set ID in that case.

(It is possible for attr->set_id to be the empty string because it may
be arbitrary user input from CLI tools.)

As of this commit, all callers of crm_xml_sanitize_id() are guaranteed
to pass a non-empty string as the argument.

This is technically a behavioral change, but it's quite an edge case,
and the existing behavior is problematic.

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

Details

Provenance
nrwahl2Authored on Mar 29 2024, 3:51 AM
Parents
rPb6041fa1c1c2: Merge pull request #3491 from nrwahl2/nrwahl2-cluster_compat_drops
Branches
Unknown
Tags
Unknown