From 1ff55052aadbd90ae1b5f70f691998b75dd48500 Mon Sep 17 00:00:00 2001 From: Nichamon Naksinehaboon Date: Mon, 1 Apr 2024 12:57:11 -0500 Subject: [PATCH] Fix the default_auth request parsing logic The parsing code adds extra STRING attribute when no authentication plugin attribute is given. --- ldms/src/ldmsd/ldmsd_request_util.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ldms/src/ldmsd/ldmsd_request_util.c b/ldms/src/ldmsd/ldmsd_request_util.c index ad4f7422f..8e12e962f 100644 --- a/ldms/src/ldmsd/ldmsd_request_util.c +++ b/ldms/src/ldmsd/ldmsd_request_util.c @@ -855,10 +855,12 @@ int __ldmsd_parse_default_auth_req(struct ldmsd_parse_ctxt *ctxt) dummy = NULL; } tmp[cnt-1] = '\0'; /* Replace the last ' ' with '\0' */ - /* Add an attribute of type 'STRING' */ - rc = add_attr_from_attr_str(NULL, tmp, - &ctxt->request, - &ctxt->request_sz); + if (cnt) { + /* Add an attribute of type 'STRING' */ + rc = add_attr_from_attr_str(NULL, tmp, + &ctxt->request, + &ctxt->request_sz); + } out: if (tmp) free(tmp);