Edward O'Callaghan has uploaded this change for review.
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>
---
M dummyflasher.c
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/54/54854/1
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.