1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 07:02:34 +02:00

dummyflasher.c: Replace atoi() with strtoul()

BUG=none
BRANCH=none
TEST=builds

Change-Id: Ib9e66016a2f4ce2d13b833c261f900cab80916b7
Spotted-by: Angel Pons <th3fanbus@gmail.com>
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/54854
Reviewed-by: Sam McNally <sammc@google.com>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Edward O'Callaghan 2021-05-23 22:14:36 +10:00 committed by Edward O'Callaghan
parent f57486e5d3
commit e3707bbf49

View File

@ -668,6 +668,7 @@ int dummy_init(void)
#if EMULATE_CHIP
struct stat image_stat;
#endif
char *endptr;
struct emu_data *data = calloc(1, sizeof(struct emu_data));
if (!data) {
@ -710,9 +711,9 @@ int dummy_init(void)
tmp = extract_programmer_param("spi_write_256_chunksize");
if (tmp) {
data->spi_write_256_chunksize = atoi(tmp);
data->spi_write_256_chunksize = strtoul(tmp, &endptr, 0);
free(tmp);
if (data->spi_write_256_chunksize < 1) {
if (*endptr != '\0' || data->spi_write_256_chunksize < 1) {
msg_perr("invalid spi_write_256_chunksize\n");
return 1;
}
@ -977,7 +978,6 @@ int dummy_init(void)
#ifdef EMULATE_SPI_CHIP
status = extract_programmer_param("spi_status");
if (status) {
char *endptr;
errno = 0;
data->emu_status = strtoul(status, &endptr, 0);
free(status);