elfctl: Fix type errors.
Target value for val has uint32_t type, not uint, adjust used constant. Change val type to unsigned so that left and right sides of comparision operator do not expose different signed types of same range [*]. Switch to unsigned long long and strtoll(3) so that 0x80000000 is accepted by conversion function [**]. Reported by: kargl [*] Noted by: emaste [**] Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28301
This commit is contained in:
parent
aa8c1f8d84
commit
9940ac808d
@ -41,6 +41,7 @@
|
||||
#include <getopt.h>
|
||||
#include <libelf.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -249,13 +250,13 @@ convert_to_feature_val(char *feature_str, uint32_t *feature_val)
|
||||
if (i == len) {
|
||||
if (isdigit(feature[0])) {
|
||||
char *eptr;
|
||||
long val;
|
||||
unsigned long long val;
|
||||
|
||||
errno = 0;
|
||||
val = strtol(feature, &eptr, 0);
|
||||
val = strtoll(feature, &eptr, 0);
|
||||
if (eptr == feature || *eptr != '\0')
|
||||
errno = EINVAL;
|
||||
else if (val > UINT_MAX)
|
||||
else if (val > UINT32_MAX)
|
||||
errno = ERANGE;
|
||||
if (errno != 0) {
|
||||
warn("%s invalid", feature);
|
||||
|
Loading…
Reference in New Issue
Block a user