mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-30 12:44:10 +08:00
* windows-nat.c (windows_xfer_shared_libraries): Avoid
memory leak when OFFSET >= LEN_AVAIL.
This commit is contained in:
parent
62ea864c39
commit
49dc7f4b47
@ -1,3 +1,8 @@
|
||||
2012-12-14 Pierre Muller <muller@sourceware.org>
|
||||
|
||||
* windows-nat.c (windows_xfer_shared_libraries): Avoid
|
||||
memory leak when OFFSET >= LEN_AVAIL.
|
||||
|
||||
2012-12-13 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* solib-svr4.c (enable_break): Use SECT_OFF_TEXT.
|
||||
|
@ -2411,11 +2411,13 @@ windows_xfer_shared_libraries (struct target_ops *ops,
|
||||
buf = obstack_finish (&obstack);
|
||||
len_avail = strlen (buf);
|
||||
if (offset >= len_avail)
|
||||
return 0;
|
||||
|
||||
if (len > len_avail - offset)
|
||||
len = len_avail - offset;
|
||||
memcpy (readbuf, buf + offset, len);
|
||||
len= 0;
|
||||
else
|
||||
{
|
||||
if (len > len_avail - offset)
|
||||
len = len_avail - offset;
|
||||
memcpy (readbuf, buf + offset, len);
|
||||
}
|
||||
|
||||
obstack_free (&obstack, NULL);
|
||||
return len;
|
||||
|
Loading…
Reference in New Issue
Block a user