mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 06:45:56 +08:00
2007-08-08 Michael Snyder <msnyder@access-company.com>
* target.c (target_read_string): Guard against null.
This commit is contained in:
@ -919,6 +919,8 @@ target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
|
||||
char *bufptr;
|
||||
unsigned int nbytes_read = 0;
|
||||
|
||||
gdb_assert (string);
|
||||
|
||||
/* Small for testing. */
|
||||
buffer_allocated = 4;
|
||||
buffer = xmalloc (buffer_allocated);
|
||||
@ -968,10 +970,9 @@ target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
|
||||
nbytes_read += tlen;
|
||||
}
|
||||
done:
|
||||
*string = buffer;
|
||||
if (errnop != NULL)
|
||||
*errnop = errcode;
|
||||
if (string != NULL)
|
||||
*string = buffer;
|
||||
return nbytes_read;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user