51 Commits

Author SHA1 Message Date
Riccardo Schirone
c1c54be39e Change macro syntax to use ; instead of ,
This change is to ease the switch to the new parser and make the syntax
more consistent and easy. As things were before this patch, ',' could be
part of an argument of a command, but at the same time it was used as a
separator when defining a new macro. This difference in how `,` is
interpreter, makes parsing commands harder, as grep specifiers,
arguments, etc. should be parsed differently based on whether they are
inside a macro body or not.

By switching to using `;` as separator in the macro body, arguments,
grep specifiers, etc. can be parsed as they would be outside of a macro
body, making the new parser more consistent and easier.
2020-03-11 00:11:01 +01:00
Paul I
0e62dda341
Fix fgets() usage (#16068) 2020-02-29 20:47:10 +01:00
Riccardo Schirone
f322c1b1bc
Add support for @* commands in new r2-shell-parser (#16038)
* Use TSSymbol instead of comparing type strings

This patch uses ts_node_symbol instead of ts_node_type to check whether
a node is of a given type. Since TSSymbol is just an integer, the check
will be much faster. Also, it allows to store commands handler in an
hashtable, instead of having if-cascade.

* Make sure r_config_hold works even when keys do not exist or are freed

* Add support for all _tmp_commands

* Make sure to always reuse the same TSLanguage

* Update both tree-sitter and radare2-shell-parser

This way we use TSLanguage version 11, which fixes some problems with
TSSymbols.

* Compute is_last_cmd on each single command and fix logging

is_last_cmd should be set on a per-command basis, so if you analyze
things like `pd 3; .; .; .;` the `.` refers to `pd 3`.

This also fixes logging, so when an invalid command is parsed, it is
still available in the history.

* Add comment about directly using r2-shell-parser in r_core_cmd_lines

r_core_cmd_lines tries to parse the input and split it in lines, but at
least in theory, we don't need it as the new parser can already handle
full scripts.

* Allow other tasks to run between commands even in the new parser

* Update radare2-shell-parser
2020-02-24 09:46:15 +01:00
radare
cfdd09c838
Fix #13738 - Autocomplete $aliases ##cons 2019-04-14 17:45:55 +02:00
radare
2aac9fa943
Initial implementation of alias files ##core (#13489)
pd 10 > $foo  # save the output of pd 10 into $foo
$foo          # print the contents of $foo (the output)
$*            # values are now printed in base64
$foo=base64:  # is now supported
2019-03-25 01:06:53 +01:00
pancake
709ffb60b6 Fixes for the android build and related warnings 2019-01-21 12:10:33 +01:00
Florian Märkl
8f87d8aa27 Fix leaks in macros (#12803) 2019-01-16 09:15:39 +01:00
dav1901
c1f30de193 Minor code cleanups free/R_FREE (#12157) 2018-11-14 21:23:20 +01:00
Neven Sajko
4a722e80d8 Add braces to if, else, for, while ... (#11504) 2018-09-13 10:17:26 +02:00
pancake
a61d80ff9f Fix last coverities and the use of r_str_cmp as list comparator
* Fix avra test and avoid long time loading trash data in avra
2018-08-11 20:59:28 +02:00
pancake
aeef9d7423 s/deinit/fini/g 2018-05-27 15:55:33 +02:00
radare
879a32d4b0
Fix use after free and oobread in pf command (#10098)
* Fix use after free and oobread in pf command

- Spotted by running the testsuite in ASAN mode

* Few minor fixes (by @sivaramaaa)
2018-05-21 01:59:25 +02:00
pancake
0b1e8eaecc Fix almost all warnings from the msvc build 2017-12-19 00:18:39 +01:00
pancake
ff8959f1b0 Add some more null deref checks here and there 2017-12-18 12:38:37 +01:00
Alex Kornitzer
93e409231f mdmp|pe: squashed some memory leaks and fixed resolve error in mdmp 2017-11-01 11:50:27 +01:00
pancake
1a1958f0e5 Fix #8469 - Fix cmd.repeat again and honor opdelta for pd 2017-09-18 16:18:12 +02:00
Roi Martin
d82235285c Implement "rabin2 -L [plugin]" and command "iL [plugin]" (#6875)
* Fix r_str_cmp to follow the documented behaviour

Now r_str_cmp behaviour is consistent.

Before:
* Returns true if both pointers are equal.
* Returns false if the strings are equal.

Now:
* Returns true if both pointers are equal.
* Returns true if the strings are equal.

* Implement "rabin2 -L [plugin]"

- Display plugin info in a proper structured way for humans with
  "rabin2 -L [plugin]".
- Fix current "rabin2 -L [-j]" output.
- Allow to specify "-j" before or after "-L".

Fix issue #6861.

* Implement command iL [plugin]

* Fix json output in rabin2 -L and iL
2017-03-01 20:05:40 +01:00
Álvaro Felipe Melchor
88d4649cc6 fix more coverities 2016-12-19 17:23:30 +01:00
pancake
9039228b58 Honor Q as an alias for q! in visual and prompt 2016-12-19 04:46:50 +01:00
Álvaro Felipe Melchor
87724384d1 added r_cons_break_{push/pop} to handle ^C better
Besides an UAF has been fixed afecting only ELF
2016-11-21 16:56:12 +01:00
pancake
35d9eef757 Fix 20 more covs (divBy0, dbl3, negidx, bufovr, ..) 2016-10-20 15:39:36 +02:00
Sven Steinbauer
2996538700 Fix #5633 - Change x == NULL to correct syntax 2016-09-19 14:44:47 +02:00
Sven Steinbauer
547f8bbc5c Infer fixes Round 2 (#4993) 2016-05-24 22:22:15 +02:00
Maijin
530dbe72c1 Save/restore macros in projects fix #4050 2016-02-07 00:51:26 +01:00
pancake
b515a34676 More stdboolification 2015-09-14 12:35:38 +02:00
dequis
003a18aa30 A few simple memory leak fixes 2015-08-30 23:20:51 +02:00
pancake
4dff5cca5e Some some COVs related to control flow and memory leaks 2015-08-24 01:58:36 +02:00
pancake
58bc5c1d6b Fix $ and =$ conflict 2015-08-20 03:06:48 +02:00
pancake
ecf5205e64 Add support for remote aliases with =$ command
For example
	=$dr   - `dr` will do `=!dr`
	=$-dr  - unset that alias command
2015-08-20 02:26:57 +02:00
shuall
0807686d86 #3052 all printf member functions changed to cb_printf 2015-08-09 03:25:05 +02:00
Álvaro Felipe Melchor
daf8e5b06f Fix some infers 2015-06-28 20:15:35 +02:00
Anton Kochkov
c5f2f3521f Fix the leaking holes 2015-04-11 02:05:51 +03:00
pancake
1a73f5e807 Handle <directory> in r2 as an alias for cd /path;r2 --
Remove noisy eprintf and fix another crash
2015-03-23 00:41:50 +01:00
pancake
ebbe450f38 Fix r2 -c 'o-*;s++' - use-after-free and other from #2220 2015-03-23 00:32:31 +01:00
pancake
de22fe28d9 Fix 7 more issues from #2220 // 3 left 2015-03-23 00:05:18 +01:00
pancake
ef6c71208d Fix tons of input crashes reported in #2220 2015-03-22 23:24:13 +01:00
pancake
12ea9734b5 Fix about 15 more random COVs 2015-03-21 02:04:49 +01:00
Julien Nabet
e20728ec15 cppcheck: fix 1 'else if' cond matches previous cond + test indice before using it 2014-11-16 18:13:06 +01:00
jvoisin
9b99c0135d Even more coverifix 2014-08-18 15:03:02 +02:00
jvoisin
8f0fa7567a Fix some memleaks found by coverity 2014-08-17 20:30:48 +02:00
jvoisin
d11aba0b0f Fix some minor coverity issues 2014-08-04 19:25:23 +02:00
pancake
8d663ceb94 Some rework on RBin.baddr and laddr to make it work again
Not all fileformats return correct data in Sections, this is
why sometimes the relocation with baddr (needed for aslr) fails
on mach0 for example. This code needs to be redesigned and fixed.
2014-05-29 00:49:28 +02:00
pancake
52ec7c4376 Blame 219da8a8e3872cba64050c9a3eb8aeab6605d23c 2014-05-12 02:04:48 +02:00
Anton Kochkov
219da8a8e3 Fix CID 1135009 2014-05-02 13:29:55 +04:00
deeso
3c3443fc2b Adding cmd deinit to core and cmd_api 2014-04-28 10:40:09 -05:00
Anton Kochkov
beab537a55 Fix CID 1147120 2014-04-27 05:25:20 +04:00
deeso
dd07844436 Fixing some Null Dereference Bugs courtesy of coverity 2014-04-22 18:39:17 -05:00
pancake
b3b5ad0da7 Add 'arf' command to find string refs (hacky util) 2014-04-21 13:50:38 +02:00
pancake
4e8ab49948 Fix freeing issue in RCore plugins and rename RCmdPlugin to RCorePlugin 2014-04-01 17:17:03 +02:00
pancake
6a835f159d Fix static link 2014-03-18 01:36:54 +01:00