mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-12 07:26:42 +00:00
Fix #588 drx segfault
This commit is contained in:
parent
c56bb2cd29
commit
e7783173c7
@ -2622,14 +2622,15 @@ static int r_debug_native_drx(RDebug *dbg, int n, ut64 addr, int sz, int rwx, in
|
||||
regs[2] = r_reg_getv (R, "dr2");
|
||||
regs[3] = r_reg_getv (R, "dr3");
|
||||
/*
|
||||
RESERVED
|
||||
regs[4] = r_reg_getv (R, "dr4");
|
||||
regs[5] = r_reg_getv (R, "dr5");
|
||||
regs[6] = r_reg_getv (R, "dr6");
|
||||
*/
|
||||
regs[6] = r_reg_getv (R, "dr6");
|
||||
regs[7] = r_reg_getv (R, "dr7");
|
||||
|
||||
if (sz == 0) {
|
||||
drx_list (regs);
|
||||
drx_list (®s);
|
||||
return R_FALSE;
|
||||
} else
|
||||
if (sz<0) {
|
||||
|
@ -144,7 +144,8 @@ int drx_next(drxt *drx) {
|
||||
void drx_list(drxt *drx) {
|
||||
ut64 addr;
|
||||
int i, rwx, len, g, en;
|
||||
for(i=0; i<4; i++) {
|
||||
for(i=0; i<7; i++) {
|
||||
rwx = len = g = en = 0;
|
||||
addr = drx_get (drx, i, &rwx, &len, &g, &en);
|
||||
printf ("%c dr%d %c%c 0x%08"PFMT64x" %d\n",
|
||||
en?'*':'-', i, g?'G':'L',
|
||||
|
@ -244,8 +244,10 @@ R_API int r_str_word_set0(char *str) {
|
||||
if (!str || !*str)
|
||||
return 0;
|
||||
for (i=0; str[i] && str[i+1]; i++) {
|
||||
if (str[i]==' ' && str[i+1]==' ')
|
||||
memmove (str+i, str+i+1, strlen (str+1)+1);
|
||||
if (str[i]==' ' && str[i+1]==' ') {
|
||||
int len = strlen (str+i+1)+1;
|
||||
memmove (str+i, str+i+1, len);
|
||||
}
|
||||
}
|
||||
if (str[i]==' ')
|
||||
str[i] = 0;
|
||||
@ -532,9 +534,12 @@ R_API char *r_str_ndup(const char *ptr, int len) {
|
||||
|
||||
// TODO: deprecate?
|
||||
R_API char *r_str_dup(char *ptr, const char *string) {
|
||||
int len;
|
||||
if (ptr) free (ptr);
|
||||
if (!string) return NULL;
|
||||
ptr = strdup (string);
|
||||
len = strlen (string)+1;
|
||||
ptr = malloc (len+1);
|
||||
memcpy (ptr, string, len);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user