Print this page
10323 cpcgen_parse_model() gets value check wrong

*** 8,18 **** * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* ! * Copyright (c) 2018, Joyent, Inc. */ /* * This file transforms the perfmon data files into C files and manual pages. */ --- 8,18 ---- * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* ! * Copyright (c) 2019, Joyent, Inc. */ /* * This file transforms the perfmon data files into C files and manual pages. */
*** 315,331 **** brand, bstr); } errno = 0; l = strtol(fam, &last, 16); ! if (errno != 0 || l < 0 || l > UINT_MAX || *last != '\0') { errx(EXIT_FAILURE, "failed to parse family \"%s\"", fam); } *family = (uint_t)l; l = strtol(mod, &last, 16); ! if (errno != 0 || l < 0 || l > UINT_MAX || *last != '\0') { errx(EXIT_FAILURE, "failed to parse model \"%s\"", mod); } *model = (uint_t)l; } --- 315,331 ---- brand, bstr); } errno = 0; l = strtol(fam, &last, 16); ! if (errno != 0 || l < 0 || l >= INT_MAX || *last != '\0') { errx(EXIT_FAILURE, "failed to parse family \"%s\"", fam); } *family = (uint_t)l; l = strtol(mod, &last, 16); ! if (errno != 0 || l < 0 || l >= INT_MAX || *last != '\0') { errx(EXIT_FAILURE, "failed to parse model \"%s\"", mod); } *model = (uint_t)l; }