mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-24 13:49:50 +00:00
Fix a null-deref in afn (#16091)
This commit is contained in:
parent
7a314accc3
commit
9e713900e5
@ -2555,7 +2555,7 @@ static bool __setFunctionName(RCore *core, ut64 addr, const char *_name, bool pr
|
||||
RAnalFunction *fcn = r_anal_get_function_at (core->anal, addr);
|
||||
if (fcn) {
|
||||
RFlagItem *flag = r_flag_get (core->flags, fcn->name);
|
||||
if (flag->space && strcmp (flag->space->name, R_FLAGS_FS_FUNCTIONS) == 0) {
|
||||
if (flag && flag->space && strcmp (flag->space->name, R_FLAGS_FS_FUNCTIONS) == 0) {
|
||||
// Only flags in the functions fs should be renamed, e.g. we don't want to rename symbol flags.
|
||||
r_flag_rename (core->flags, flag, name);
|
||||
} else {
|
||||
|
@ -45,6 +45,12 @@ afn @ 0x080483f4
|
||||
f@F:functions~483f4,48540
|
||||
?e --
|
||||
f@F:*~483f4,48540
|
||||
f- myfunc
|
||||
afn createdflag @ 0x080483f4
|
||||
?e Non-existing flags should be created
|
||||
f@F:functions~483f4,48540
|
||||
?e --
|
||||
f@F:*~483f4,48540
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
0x080483f4 33 fcn.080483f4
|
||||
@ -70,5 +76,13 @@ Here the flag is owned by the fcn and should be renamed:
|
||||
0x08048540 92 main
|
||||
0x08048540 92 sym.main
|
||||
0x08048540 92 mymain
|
||||
Non-existing flags should be created
|
||||
0x080483f4 33 createdflag
|
||||
0x08048540 92 mymain
|
||||
--
|
||||
0x080483f4 33 createdflag
|
||||
0x08048540 92 main
|
||||
0x08048540 92 sym.main
|
||||
0x08048540 92 mymain
|
||||
EOF
|
||||
RUN
|
||||
|
Loading…
Reference in New Issue
Block a user