246 Commits

Author SHA1 Message Date
pancake
d3157e2ed3
Fix 32 critical COVs (UAF, UB and OOB) (#18077) 2020-12-21 01:10:22 +01:00
Lazula
243bc871c3 Multiple refactors in io and util ##io ##util ##refactor
* Add r_io_map macros throughout code base
* Update string NULL-checking with renamed functions r_str_get() and r_str_getf()
* Change string NULL-checks throughout code base to use functions
* Add r_str_get_fail() to specify a custom string to return if NULL-check fails
* Mark JSON to be updated with PJ with "TODO PJ"
* Incidental style updates such as missing spaces
2020-12-13 05:09:13 +01:00
Anton Kochkov
01ed730eac Fix Windows tests 2020-11-09 18:52:16 +08:00
GustavoLCR
a26f6c5656
Fix r_core_editor() on Windows (#17887) ##windows 2020-11-02 16:09:53 +01:00
Damien Zammit
2a0d8fbe59
Install r2sdb, detect R2_HOME_SDB_FCNSIGN for r2extras custom CC ##build
* cc: Add autodetection for R2_HOME_SDB_FCNSIGN new location of custom calling conventions
* Fix r_file_exists not expanding tilde path
* r2sdb: Install executable
2020-09-24 12:26:53 +02:00
pancake
797b937175
Implement touch command ##shell (#17645) 2020-09-15 11:11:41 +02:00
mscherer
42f90d5df5
Return empty string when slurping a empty file (#17520) 2020-09-03 09:46:17 +02:00
GustavoLCR
bb3e80c040
Implement pde to disassemble following code execution ##disasm (#17410)
* Implement `pde` to disassemble following code execution
* Fix `asm.filter=1` with `scr.color=0`
* Fix cache not being used
* Share read and write file permissions on Windows
* Use CreateFileW in r_sandbox_open on Windows and fix file permissions
* Fix opening nul and O_RDWR
* File creation flags cannot be combined on Windows
* Share write in r_file_mmap_windows
2020-08-13 10:05:38 +08:00
Florian Märkl
68a1db448d
Merge everything time-related in r_time.h (#17445) 2020-08-12 18:54:49 +02:00
Anton Kochkov
b0e3d0c4f9
mkstemps() is available only since glibc 2.19 (#17415) 2020-08-07 21:07:48 +08:00
pancake
340c006db8
Fix #17322 - Honor bin.baddr from idp to load rebased PDB files ##bin (#17321)
Co-authored-by: pancake <pancake@nopcode.org>
2020-08-07 17:25:56 +08:00
Riccardo Schirone
3e6fe7156d
Fix infinite loop regression in Linux debugger by using ferror in addition to feof() ##debug (#17259)
* Check for ferror(), not only for feof()

Some files could not be read and would create an infinite loop during
the execution of r_file_slurp. This patch fixes that issue: when an
error occur at read time, it detects it with ferror(fd) and it returns
an empty buffer.

* Call ferror inside loop and fclose fd
2020-07-15 09:16:59 +08:00
pancake
d47aed440a
Fix covs from 2020-06-29 (#17184)
* Fix covs from 2020-06-29

* CIDs: 1293553 1408695 1430058 1430059 1430060
1430061 1430062 1430063 1430064 1430065 1430067

* More fixes

Co-authored-by: pancake <pancake@nopcode.org>
2020-07-01 09:33:38 +08:00
pancake
c706d0b69f
Improve code quality of file and sandbox ##util (#17136)
* Improve code quality of file and sandbox ##util
* Use `r_return_*`
* Read procfiles once

Co-authored-by: pancake <pancake@nopcode.org>
2020-06-29 13:23:02 +08:00
pancake
e56c784791
Optimize r_file_proc_size() reading by blocks instead of chars ##util (#17119)
* Optimize r_file_proc_size() reading by blocks instead of chars ##util

For /proc/self/maps this is almost 2x faster, will be much faster on bigger files

* Make it static, it's not even defined in r_file.h
* Rename `r_file_proc_size()` into `procfile_size()`

Co-authored-by: pancake <pancake@nopcode.org>
Co-authored-by: Anton Kochkov <xvilka@gmail.com>
2020-06-23 13:25:14 +08:00
Fangrui Song
3380e7c9da
r_file_slurp: don't choke on an empty file (#17118)
If `0` is an empty file:

% radiff 0 1
radiff2: Cannot open 0

This patch fixes it.
2020-06-22 12:15:33 +08:00
pancake
160fc95e66
Use (void) instead of () in function signatures (#17026) ##refactoring
* Use (void) instead of () in function signatures
* Add test to avoid further contributions to commit the same mistake
2020-06-14 16:08:32 +02:00
pancake
529e192982
Use more size_t in util/str (#16825) 2020-05-16 12:34:14 +02:00
pancake
afeb859366
Boolify some RUtil.file APIs ##util (#16734) 2020-04-28 14:00:42 +08:00
pancake
9ea0b7ce56 Release 4.4.0 - Codename: pangolin 2020-04-14 04:47:35 +02:00
Florian Märkl
6d633a96a9
Run Fuzz Tests with r2r (#16456) 2020-04-07 13:27:19 +02:00
Florian Märkl
91c58506e5
Enable R2R in C for all CI except Windows (#16354) ##test 2020-04-01 23:16:02 +02:00
Florian Märkl
0b5e78e923
Make size arg of r_file_slurp() size_t (#16221) 2020-03-15 23:34:38 +01:00
radare
6ae8806411
Do not use the elvis operator for bool expressions (#16073) 2020-02-28 15:19:37 +01:00
pancake
b7cc6999ac Aim to fix another integer overflow in r_file_slurp 2019-12-05 17:49:21 +01:00
radare
bbe6c0e184
Fix #10851 - Solve slurp messages on http/sandbox/pipe ##remote 2019-09-16 14:25:37 +02:00
dodococo
5dd819e847 Implemented head and tail commands ##core 2019-07-25 18:51:30 +02:00
radare
67fbd0e0d8
Better use of perm/mode names in R_IO ##io (#14615)
* Aim to fix O_BINARY issue in rahash2 on windows
2019-07-23 10:03:33 +02:00
Anton Kochkov
20e19d6023 More spelling fixes in the code 2019-06-20 13:36:02 +08:00
radare
4dbe1453f5
Initial cleanup in RParse, delete mreplace plugin ##disasm
* Also voidify and boolify anal, parse, cons, bin, ..
2019-06-17 02:23:58 +02:00
GustavoLCR
f0b7fcfd7a Enable r_stdin_slurp on Windows (#14312) 2019-06-16 09:45:13 +02:00
Riccardo Schirone
66f7403245 Rewrite the RBuffer API to make it safer and adjust the codebase ##refactor (#13656)
* Reimplement r_buf_fread/fwrite
* Add slice buffer and introduce readonly field
* Do nothing if size is 0
* Prevents an overflow when 8 is subtracted from size.
* Fix ragg2 when patching outside currently existing buffer
* Implement r_mem_mmap_resize for systems where mremap is not defined
* r_buf_buffer can be called with no size arg as well
* Use size_t instead of ut64
2019-05-15 15:34:06 +02:00
radare
aaf93c20d5
More improvements in the current flagtags and ftl->ftw ##flags 2019-04-19 16:54:53 +02:00
radare
e04f31a313
Completely kill the msvc/ directory and the unix-specific includes workarounds 2019-03-19 17:34:02 +01:00
GustavoLCR
3fba693b91 Add support for UTF console input in Windows (#13338) ##windows
* Add support for UTF console input in Windows
* Convert ANSI input to UTF-8
* Convert UTF-8 to acp when calling ANSI version of functions
* Determine if Windows console output is UTF-8 on the fly
2019-03-18 16:05:38 +08:00
Anton Kochkov
bb67b54f74
Remove CYGWIN & MINGW remnants (#13377) 2019-03-15 12:55:08 +08:00
GustavoLCR
b1497b8a67 Fix #13301 - Fix crash when unicode support is enabled ##windows 2019-03-13 13:39:02 +01:00
GustavoLCR
23e74f9432 Fix abspath issue and implement r_file_copy using native api ##windows 2019-02-07 12:43:29 +01:00
GustavoLCR
963ed894ba Fix path issue when last char is a slash ##windows 2019-02-03 17:04:50 -06:00
BlaCoiso
2af904856f Fix mount shell and ed commands (#12312) 2018-11-24 22:52:08 +01:00
David CARLIER
c504572cfa Further cleanup-code/less "optimistic" assumptions. (#12298) 2018-11-23 23:18:40 +01:00
radare
d05292e485
Fix 80 warnings coming from gcc8.2 (#12280) 2018-11-22 22:11:43 +01:00
dav1901
8b83d03c99 Minor code cleanups free/R_FREE (#12145) 2018-11-13 23:41:28 +01:00
a1ext
4e8e7de7b4 Fix unicode path issues in Windows ##windows 2018-10-30 01:04:47 +01:00
radare
e2f1fe1da6
Fix build for GNU/Hurd by removing the PATH_MAX usage (#11816) 2018-10-15 15:17:42 +02:00
Neven Sajko
4a722e80d8 Add braces to if, else, for, while ... (#11504) 2018-09-13 10:17:26 +02:00
Paul I
b5044de59b Fix agw command (#11217) 2018-08-23 18:35:24 +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
radare
0969b835de
Fix last covs (#10973) 2018-08-07 13:06:23 +02:00
cyanpencil
3fda01343d Fix: coverities 1394583 1394582 1394447 2018-08-01 17:52:06 +02:00