Skip to content

Commit d1b628b

Browse files
Ehab-24Rot127
andauthored
fix use-after-free in txl command (#5980)
* fix use-after-free in txl command * add cmd_txl test --------- Co-authored-by: Rot127 <45763064+Rot127@users.noreply.github.com>
1 parent 3da3a22 commit d1b628b

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

librz/core/cmd/cmd_type.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,13 @@ static void types_xrefs_all(RzCore *core) {
254254
rz_list_free(types);
255255
}
256256
RzList *uniq_types = rz_list_uniq(types_list, (RzListComparator)strcmp, NULL);
257-
rz_list_free(types_list);
258257
rz_list_sort(uniq_types, (RzListComparator)strcmp, NULL);
259258
char *typestr;
260259
rz_list_foreach (uniq_types, iter, typestr) {
261260
rz_cons_printf("%s\n", typestr);
262261
}
263262
rz_list_free(uniq_types);
263+
rz_list_free(types_list);
264264
}
265265

266266
RZ_IPI RzCmdStatus rz_type_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode) {

test/db/cmd/cmd_txl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
NAME=txl1
2+
FILE=bins/mach0/objc-employee
3+
TIMEOUT=10
4+
CMDS=<<EOF
5+
aaa
6+
txl
7+
EOF
8+
EXPECT=<<EOF
9+
char
10+
int
11+
int64_t
12+
void
13+
EOF
14+
RUN
15+
16+
NAME=txl2
17+
FILE=bins/elf/ls
18+
TIMEOUT=60
19+
CMDS=<<EOF
20+
aaa
21+
txl
22+
EOF
23+
EXPECT=<<EOF
24+
char
25+
int
26+
int64_t
27+
size_t
28+
time_t
29+
tm
30+
unsigned long
31+
void
32+
wchar_t
33+
wint_t
34+
EOF
35+
RUN

0 commit comments

Comments
 (0)