From 2d4594f9942862f63a749b3b743b9d51c1c7b1e6 Mon Sep 17 00:00:00 2001 From: Morris Jette <jette@schedmd.com> Date: Thu, 13 Oct 2016 20:22:03 -0600 Subject: [PATCH] Fix data sign issue Fix for possibly treating a negative number as a positive. Problem reported by Coverity. --- src/slurmctld/licenses.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slurmctld/licenses.c b/src/slurmctld/licenses.c index e60bb02b4d1..07e52a1a55e 100644 --- a/src/slurmctld/licenses.c +++ b/src/slurmctld/licenses.c @@ -136,7 +136,7 @@ static List _build_license_list(char *licenses, bool *valid) tmp_str = xstrdup(licenses); token = strtok_r(tmp_str, ",;", &last); while (token && *valid) { - uint32_t num = 1; + int32_t num = 1; for (i = 0; token[i]; i++) { if (isspace(token[i])) { *valid = false; @@ -147,7 +147,7 @@ static List _build_license_list(char *licenses, bool *valid) */ if ((token[i] == ':') || (token[i] == '*')) { token[i++] = '\0'; - num = (uint32_t)strtol(&token[i], &end_num,10); + num = (int32_t)strtol(&token[i], &end_num, 10); } } if (num < 0) { -- GitLab