From b99597b3f0b6cb9bc7873a1d0a89f7605cecfe9f Mon Sep 17 00:00:00 2001 From: Packit Service Date: Feb 24 2021 16:07:35 +0000 Subject: Apply patch 0009-libmultipath-set_uint-fix-parsing-for-32bit.patch patch_name: 0009-libmultipath-set_uint-fix-parsing-for-32bit.patch present_in_specfile: true location_in_specfile: 9 --- diff --git a/libmultipath/dict.c b/libmultipath/dict.c index 3e25e74..0e9ea38 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -60,19 +60,22 @@ static int set_uint(vector strvec, void *ptr) { unsigned int *uint_ptr = (unsigned int *)ptr; - char *buff, *eptr; - long res; + char *buff, *eptr, *p; + unsigned long res; int rc; buff = set_value(strvec); if (!buff) return 1; - res = strtol(buff, &eptr, 10); + p = buff; + while (isspace(*p)) + p++; + res = strtoul(p, &eptr, 10); if (eptr > buff) while (isspace(*eptr)) eptr++; - if (*buff == '\0' || *eptr != '\0' || res < 0 || res > UINT_MAX) { + if (*buff == '\0' || *eptr != '\0' || !isdigit(*p) || res > UINT_MAX) { condlog(1, "%s: invalid value for %s: \"%s\"", __func__, (char*)VECTOR_SLOT(strvec, 0), buff); rc = 1;