diff options
author | Amitay Isaacs <amitay@ozlabs.org> | 2018-08-02 14:35:07 +1000 |
---|---|---|
committer | Alistair Popple <alistair@popple.id.au> | 2018-08-02 15:47:17 +1000 |
commit | 85c6181c2c9af0d95b398639a56587f1497b5608 (patch) | |
tree | 1f4763ca703a6191268044c588fe787d6301fe8c | |
parent | dd44f3f542d14eb503587b73cd8b51fb5360288a (diff) | |
download | pdbg-85c6181c2c9af0d95b398639a56587f1497b5608.tar.gz pdbg-85c6181c2c9af0d95b398639a56587f1497b5608.zip |
mem: Avoid floating point exception if size == 0
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
-rw-r--r-- | src/mem.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -46,6 +46,11 @@ static int getmem(uint64_t addr, uint64_t size, struct mem_flags flags) uint8_t *buf; int rc = 0; + if (size == 0) { + PR_ERROR("Size must be > 0\n"); + return 1; + } + buf = malloc(size); assert(buf); pdbg_for_each_class_target("adu", target) { |