From 8f5d3131fbc728b95ee1fdcf170752231f034be0 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Mar 09 2021 06:18:46 +0000 Subject: Low: libcrmcommon: compare CRM_meta_ properly Previously, when filtering XML attributes for digests, we would filter attributes starting with "CRM_meta" case-insensitively. Now, compare against "CRM_meta_" case-sensitively. This could potentially cause resource restarts after upgrading to a version with this commit, for any resource that has instance attributes that start with something like "crm_meta" -- a highly unlikely scenario. --- diff --git a/lib/common/operations.c b/lib/common/operations.c index f3a11be..421aaac 100644 --- a/lib/common/operations.c +++ b/lib/common/operations.c @@ -362,14 +362,14 @@ decode_transition_key(const char *key, char **uuid, int *transition_id, int *act return TRUE; } -#define CRM_META_LEN (sizeof(CRM_META) - 1) +// String length of CRM_META"_" +#define CRM_META_LEN sizeof(CRM_META) // Return true if a is an attribute that should be filtered static bool should_filter_for_digest(xmlAttrPtr a, void *user_data) { - // @TODO CRM_META check should be case-sensitive - return (strncasecmp((const char *) a->name, CRM_META, CRM_META_LEN) == 0) + return (strncmp((const char *) a->name, CRM_META "_", CRM_META_LEN) == 0) || pcmk__str_any_of((const char *) a->name, XML_ATTR_ID, XML_ATTR_CRM_VERSION,