Edward O'Callaghan submitted this change.
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>
---
M dummyflasher.c
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dummyflasher.c b/dummyflasher.c
index 2f39c98..4661f3d 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -668,6 +668,7 @@
#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 @@
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 @@
#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);
To view, visit change 54854. To unsubscribe, or for help writing mail filters, visit settings.