diff options
author | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-13 00:33:48 +0000 |
---|---|---|
committer | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-13 00:33:48 +0000 |
commit | 890973acc46bcf21031a28ac5ac97154989dc3c4 (patch) | |
tree | 431c25144f4f8a3acd6f273e525a8dbcf3559c69 /src | |
parent | bb37adadab7e99ce139179c1cb8322a7e1e921cb (diff) | |
download | openocd+libswd-890973acc46bcf21031a28ac5ac97154989dc3c4.tar.gz openocd+libswd-890973acc46bcf21031a28ac5ac97154989dc3c4.tar.bz2 openocd+libswd-890973acc46bcf21031a28ac5ac97154989dc3c4.tar.xz openocd+libswd-890973acc46bcf21031a28ac5ac97154989dc3c4.zip |
Improve handle_dump_image_command argument parsing:
- Use parse_u32 to ensure address and size parse properly.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2233 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r-- | src/target/target.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/target/target.c b/src/target/target.c index 523b6fa1..ded4d55d 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2266,10 +2266,8 @@ static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cm { fileio_t fileio; - u32 address; - u32 size; u8 buffer[560]; - int retval=ERROR_OK, retvaltemp; + int retvaltemp; duration_t duration; char *duration_text; @@ -2282,8 +2280,15 @@ static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } - address = strtoul(args[1], NULL, 0); - size = strtoul(args[2], NULL, 0); + u32 address; + int retval = parse_u32(args[1], &address); + if (ERROR_OK != retval) + return retval; + + u32 size; + retval = parse_u32(args[2], &size); + if (ERROR_OK != retval) + return retval; if (fileio_open(&fileio, args[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK) { |