summaryrefslogtreecommitdiff
path: root/opcodes/dis-buf.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-08-10 15:02:41 +0000
committerIan Lance Taylor <ian@airs.com>1999-08-10 15:02:41 +0000
commit8a7a9dc9d9f5b26dc5f5b9e0adf6b326c7c373e6 (patch)
tree2e8cf643c7d8f18c3c5a9f7456ea1e1c6dc9f55f /opcodes/dis-buf.c
parent1bfe9d0d58df1f3831df939bd8b8e42a4bd94775 (diff)
downloadgdb-8a7a9dc9d9f5b26dc5f5b9e0adf6b326c7c373e6.tar.gz
From Wally Iimura <iimura@microunity.com>:
* dis-buf.c (buffer_read_memory): Rewrite expression to avoid overflow at end of address space. (generic_print_address): Use sprintf_vma.
Diffstat (limited to 'opcodes/dis-buf.c')
-rw-r--r--opcodes/dis-buf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/opcodes/dis-buf.c b/opcodes/dis-buf.c
index c6e512122eb..523fe72789d 100644
--- a/opcodes/dis-buf.c
+++ b/opcodes/dis-buf.c
@@ -30,7 +30,7 @@ buffer_read_memory (memaddr, myaddr, length, info)
struct disassemble_info *info;
{
if (memaddr < info->buffer_vma
- || memaddr + length > info->buffer_vma + info->buffer_length)
+ || memaddr - info->buffer_vma + length > info->buffer_length)
/* Out of bounds. Use EIO because GDB uses it. */
return EIO;
memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length);
@@ -67,7 +67,10 @@ generic_print_address (addr, info)
bfd_vma addr;
struct disassemble_info *info;
{
- (*info->fprintf_func) (info->stream, "0x%x", addr);
+ char buf[30];
+
+ sprintf_vma (buf, addr);
+ (*info->fprintf_func) (info->stream, "0x%s", buf);
}
/* Just concatenate the address as hex. This is included for