Commit graph

51 commits

Author SHA1 Message Date
Giovanni
f2f26b4466
Add pF8 for decoding PKCS8 & add info on /cm (#5647) 2025-12-20 16:28:10 +08:00
Rot127
067add70f9
doc: add some rz_file_*() functions descriptions (#4991) 2025-03-12 11:41:17 +08:00
Rot127
0d778415f3 Document rz_file_slurp_range 2025-03-08 22:52:54 +08:00
Giovanni
db1e4993a0
Replace strdup with rz_str_dup (#4634) 2024-09-15 19:12:07 +08:00
Peiwei Hu
29b303a3c6
cons: remove useless member <lastline> (#4540)
* also fix several memory leak
2024-06-07 13:28:27 +08:00
Gleb Popov
c6dc4ee906 Make rz_file_path_join prepared for an empty string in the first arg 2023-08-03 15:35:25 +08:00
Siddharth Mishra
9ab709bc34
Improve cmd_help.yaml and fix random number generator (#3452)
* Improve cmd_help.yaml and fix a small bug
* Add support for 64bit random numbers
* Make a distinction between 32- and 64-bit PRNG
* Add documentation for new functions
* Change the RBTree test to use 32-bit random numbers
2023-04-07 20:22:01 +08:00
Riccardo Schirone
e28345946a util: fix resize of mmap-ed files
When resizing files through `r` commands, although the buffers seemed to
be resized while the file was opened, the files were not really
truncated. Thus when re-opening the written file, no actual change was
made.
2023-04-05 17:15:52 +08:00
Anton Kochkov
a9096718e9
Coverity fixes - memory leaks, NULL dereferences (#3339)
* Fix CID 398788 - memory leak

* Fix CID 397077 - remove useless comparison

* Fix CID 397076 - remove useless comparison

* Fix CID 397074 - remove useless comparison

* Fix CID 396207 - memory leak

* Fix CID 392014 - bad shift

* Fix CID 391965 - NULL dereference

* Fix CID 390010 - wrong assert use

* Fix CID 378899 - unitialized variable

* Fix CID 378859 - integer overflow

* Fix CID 366898 - remove useless comparison

* Fix CID 364035 - NULL dereference

* Fix CID 317001 - closing "-1" file descriptor

* Fix CID 316991 - lseek() to negative position

* Fix CID 316172 - mmap() with negative size

* Fix CID 401510 - double free

* Fix CID 395360 - remove useless comparison

* Fix CID 352574 - negative loop bound

* Fix CID 316187 - memory leak

* Fix CID 395425 - memory leak

* Fix CID 316975 - buffer overrun

* Fix CID 316947 - memory leak

* Fix CID 398474 - integer overflow
2023-02-04 20:01:42 +08:00
Dean
59b38e6efa
Add /*<type>*/ comments everywhere (#2986)
Adds /*<type>*/ comments and a linter check from rz-bindgen to enforce
their existence and consistency

Also includes the following fixes made when adding the annotations:
* removed unused intern_table arguments in pyc_dis.c, pyc_dis.h, asm_pyc.c
* removed unused classes argument from place_nodes in agraph.c
* removed unused recurse and recurse_bb functions in canalysis.c
* removed unused vars field from RzPrint struct
* removed unused RzAnalysisType* structs from rz_analysis.h
* removed unused list field from RzEgg struct
* fixed bug in bp_plugin.c where duplication-checking logic iterates over the wrong list
* removed unused q_regs field from RzDebug struct
* removed unused backtrace field from RzDebugPlugin struct
* removed unused classes_list field from RzBinNXOObj struct
* removed unused methods_list and classes_list fields from RzBinZimgObj struct
2022-09-11 13:04:53 +08:00
David CARLIER
d964f85564
rz_file_copy use copy_file_range (linux only) (#2570) 2022-04-29 11:03:12 +02:00
Anton Kochkov
b1e48a0c1c
Various Coverity fixes (#2499)
* Fix CID 390322 - memory leak
* Fix CID 390031 - memory leak
* Fix CID 390014 - memory leak
* Fix CID 389941 - memory leak
* Fix CID 389093 - memory leak
* Fix CID 389090 - memory leak
* Fix CID 379250 - memory leak
* Fix CID 378897 - unterminated string
* Fix CID 378854 - memory leak
* Fix CID 373736 - memory leak
* Fix CID 371126 - memory leak
* Fix CID 371089 - memory leak
2022-04-05 22:42:36 +02:00
GustavoLCR
e945fb0e31 Introduce rz_file_dos_basename() API
Use it whenever we need to interact with paths that can contain `\` as a separator as well
2022-03-29 09:27:51 +08:00
GustavoLCR
77c46e1c9d Fix rz_file_basename on Windows 2022-03-29 09:27:51 +08:00
GustavoLCR
170ab3eb3b
Remove windows.h include from rz_types.h (#2410)
* Create `rz_windows.h`
* Move `RzThread` structure definitions to internal header
* Create and use `rz_th_get_user()` API to avoid exposing `RzThread` layout in external header
* Make `rz_th_self()` an IPI
* Use `_wmkdir()` in `rz_sys_mkdir()` on Windows
* Remove unused `winkd_break_read` function
* Remove `RzIORap` definition from `rz_io.h`
* Remove include of `Windows.h` from `rz_types.h`
* Use `rz_windows.h` when necessary
* Remove `RzCoreRtrHost` definition from `rz_core.h`
* Remove `rz_socket.h` include from `rz_core.h`
2022-03-16 13:54:41 +01:00
GustavoLCR
33ae85df35 Fix stat failing for files with size bigger than 2GB on Windows 2022-03-03 21:52:41 +08:00
yossizap
b744c8749a
Fix rz_path_prefix not working when BINDIR is at the root directory or several folders deep (#2332)
* Add an option to provide a custom prefix for portable binaries
* Use bindir's depth to find the portable root path in rz_path_prefix
* Skip the prefix folder check if we are not in bindir
2022-02-22 11:08:56 +08:00
Florian Märkl
e2edd9d1ef
Fix many pointer/int conversion warnings on arm32 (#2246)
This is -Wint-to-pointer-cast and -Wpointer-to-int-cast of gcc 10 on
arm32
2022-01-25 11:41:17 +01:00
Riccardo Schirone
64469f2811
Changes in how paths are handled (#1997)
* Remove `RIZIN_EXTRAS` because useless

Extras plugin should be treated as any other regular plugin, they should
not have their own directory. I believe we did not have anyway any
plugin using that directory.

* Do not use `<version>` in `/usr/share`

Users can only install one version of Rizin at a time anyway, thus
splitting the `/usr/share/rizin` directories does not really bring
multi-version install possible. At the same time, we stick to what's
common for other tools, which do not use version in `/usr/share`

* Move plugin directory to `/usr/lib64/rizin/plugins`
* Remove `RZ_HOME_BIN` env var because not useful anymore
* Introduce `rz_util/rz_path` to provide rizin paths
* Use `rz_path_system_sdb_types` whenever it makes sense
* Use some others `rz_path_*` functions instead of custom ones
* Use `rz_path` APIs for themes, fortunes and signatures
* Remove `rz_sys_prefix`
* Reduce the number of defines needed to handle home and system paths
* Reduce the number of `rz_path` functions
* Make the lib debug depending on log level and `RZ_LOG_DEBUG`
* Refactor a bit how directory of plugins are loaded
* Keep supporting old plugins directory for at least 0.4.0
2021-11-30 13:36:38 +08:00
Dhruv Maroo
34d345d884 Format according to clang-format-13 2021-11-25 15:44:28 +08:00
Anton Kochkov
b4c6c38a58
Various fixes in RzUtil (#1938)
* Fix CID 315916
* Fix CID 316056
* Fix CID 316254
* Fix CID 316499
* Fix CID 316542
* Fix CID 316618
* Fix CID 316641
* Fix CID 316642
2021-11-04 22:54:09 +08:00
Florian Märkl
d5dea0a088 Fix realpath usage for old BSD/Mac OS X 2021-10-26 10:50:22 +02:00
Anton Kochkov
c4c6073074
Various memory leaks and UAF fixes (#1876)
* Fix CID 359880
* Fix CID 359879
* Fix CID 359878
* Fix CID 358605
* Fix CID 358598
* Fix CID 358593
* Fix CID 358591
* Fix CID 358591
* Fix CID 358574
* Fix CID 358573
* Fix CID 358570
* Fix CID 358561
* Fix CID 358551
* Fix CID 358551
* Fix CID 358541
* Fix CID 358531
* Fix CID 358525
* Fix CID 358521
* Fix CID 357819
* Fix CID 357816
* Fix CID 357646
* Fix CID 357646
* Fix CID 357645
* Fix CID 357643
* Fix CID 356605
* Fix CID 356312
* Fix CID 354046
* Fix CID 354036
* Fix PDB unit tests
2021-10-24 10:22:30 +08:00
GustavoLCR
a7602055e8
Unicode fixes for Windows (#1703)
* Remove unnecessary calls to `rz_acp_to_utf8()` from function on Windows

This is unnecessary since d7e7bae79e

* Make `rz_file` APIs use `W` variant of Windows APIs

* Rename variables from `var_` -> `wvar`
2021-09-17 15:05:00 +08:00
Giovanni
6e4cad4474
CID 315924: Out-of-bounds access (OVERRUN) (#1653) 2021-09-11 09:31:19 +02:00
Riccardo Schirone
6aef990eef Fix few clang-cl warnings 2021-09-04 12:06:07 +02:00
Dhruv Maroo
a25ef4e9c6
Add rz_deflate* functions and save projects in compressed format (#1446) 2021-08-30 16:54:09 +08:00
Anton Kochkov
2b6b373f0f
Detect copyfile() with Meson (#1524) 2021-08-25 13:36:35 +02:00
Giovanni
8fe4d0b0a5
Convert ! commands to newshell (#1235)
* Updated core_plugin_example.c
* Removed RZ_BYTES and RZ_BLOCK
Co-authored-by: Riccardo Schirone <sirmy15@gmail.com>
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2021-07-28 10:33:33 +02:00
Anton Kochkov
98d23dbbe4 Fix Coverity CID 316863 (UAF) 2021-04-09 19:46:34 +08:00
Anton Kochkov
b211f21967 Fix Coverity CID 317127 2021-04-09 19:46:34 +08:00
Anton Kochkov
f4775c86a3 Fix Coverity CID 317135 2021-04-09 19:46:34 +08:00
Anton Kochkov
b981f2603d Fix Coverity CID 317138 2021-04-09 19:46:34 +08:00
karliss
0da80d8983
Fix some leaks. (#968) 2021-04-05 17:00:44 +03:00
pancake
a22ceb2de8 Add rz_file_binsh() and avoid hardcoding /bin/sh for Termux ##android (#18409)
Inspired by https://github.com/termux/termux-packages/blob/master/packages/radare2/libr-util-sandbox.c.patch
2021-03-16 16:57:32 +08:00
Riccardo Schirone
53bf5c497f SPDX Copyright text for all files based on history
- Add LICENSES directory
- Download additional licenses used
- Add .reuse directory
- Add doc about SPDX/reuse

Co-authored-by: Florian Märkl <info@florianmaerkl.de>
2021-03-05 19:39:15 +08:00
Alexis Ehret
7e377bfdcf Fix dead nested assignment librz/util/file.c 2021-02-02 21:47:49 +00:00
Anton Kochkov
a0be4e2e64 Run clang-format 2021-01-21 22:05:44 +08:00
Khairul Azhar Kasmiran
d5601cc2fe
Replace naked rz_sys_system/write/read/freopen calls with their wrapped counterparts (#388) 2021-01-19 00:07:19 +08:00
Riccardo Schirone
7316b71619 Simplify io_default with RzBuffer 2021-01-03 11:42:38 +01:00
Riccardo Schirone
d25cea5420 Rewrite rz_file_mmap API 2021-01-03 11:42:38 +01:00
Riccardo Schirone
73080975d4 Fix autocompletion unit tests on Windows by using RZ_SYS_DIR 2021-01-03 11:42:38 +01:00
Florian Märkl
40a29cba29
Remove Pseudo-Sandbox (#239) 2020-12-21 21:31:32 +01:00
Florian Märkl
c5021f7c8a
Add High-Level Binary File Reference to Projects (#99) 2020-12-01 11:57:01 +01:00
Riccardo Schirone
e8395cf52e Fix rz_file_dirname when path is "." 2020-11-20 23:32:23 +01:00
Riccardo Schirone
c98e393618 Add initial version to complete filenames, env and choices ##newshell
* Add unit test for RzCore autocompletion
2020-11-16 16:19:35 +01:00
Anton Kochkov
539f60a1a8
Rename radare to rizin (#68)
* Rename radare to rizin

- Rename REvent to RzEvent
- Rename RBreakpoint to RzBreakpoint
- Rename RRune to RzRune

* Remove unnecessary files
2020-11-04 18:56:27 +08:00
Florian Märkl
6572b63794
Use Standard SPDX Header Comments (#51) 2020-10-27 09:04:11 +01:00
Riccardo Schirone
7ceebc725e Mass renaming r2 to rz/rizin 2020-10-13 12:43:34 +02:00
Riccardo Schirone
502e91aff7
Rename R_ and R2_ to RZ_ (#8)
* Rename R2_ -> RZ_
* Rename R_ -> RZ_
* Rename R2R_ -> RZ_TEST_
* Rename R2R defines and types to RZ_TEST/RzTest
* Keep R_ for REIL registers
2020-10-02 16:09:13 +02:00