416 Commits

Author SHA1 Message Date
pancake
d3157e2ed3
Fix 32 critical COVs (UAF, UB and OOB) (#18077) 2020-12-21 01:10:22 +01:00
pancake
3a14d204ea
Do not show return code message in r2pipe api if it succeds (#17854)
Co-authored-by: pancake <pancake@nopcode.org>
2020-10-27 14:25:37 +08:00
David CARLIER
b1996da031
Setting ASLR support for DragonFlyBSD ##util (#17810)
Enable calls for rarun2
2020-10-22 16:26:53 +08:00
Liumeo
4a6b69b2d2
Fix ARM64 test_r2pipe_404 (#17796) 2020-10-19 12:47:31 +08:00
GustavoLCR
623c4819d6
Fix some warnings in WinDBG plugin (#17784) 2020-10-14 14:51:11 +08:00
Riccardo Schirone
741d22ed61
Use -Werror when building in CI (#17781) 2020-10-13 12:42:57 +02:00
pancake
62c2128b6f
Better use of the R_SOCKET_PROTO_DEFAULT and add _NONE (#17644)
* Better use of the R_SOCKET_PROTO_DEFAULT and add _NONE ##http

* Fix regressions in: r2 -C and =+ ##r2pipe

Introduced in 04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9

* Implement sleep command ##shell

* Add tests for the webserver and remoting

* Implement daemon directive in rarun2, fix http test ##rarun2

* Fix socket timeout on Windows (patch by @GustavoLCR) ##socket

* Missing http.root is not a reason to not start the webserver ##http

* Fix r2 -C, =!=0, replace curl with r2 in the webserver test ##http

* Honor anal.in/from/to in aae, optimize db/formats/mach0/thumb ##anal

* Bug fixes and performance improvements

Co-authored-by: pancake <pancake@nopcode.org>
2020-09-25 19:51:23 +08:00
Keegan S
36e9314832
Fix #17638 - Fix http server by using TCP in RSocket's protocol ##remote (#17641)
Co-authored-by: meme <meme@users.noreply.github.com>
2020-09-15 11:22:04 +02:00
Khairul Azhar Kasmiran
d9057505dc
Set RPATH/RUNPATH on r2 libs too if local (#17639) 2020-09-15 09:16:14 +02:00
pancake
6ead7f0eea
Avoid close(-1) in r2pipe (#17617)
* Do not close(-1)
* Remove commented code

Co-authored-by: pancake <pancake@nopcode.org>
2020-09-10 11:56:58 +08:00
Riccardo Schirone
2318e1afcc Use SSL_get_error only if SSL is being used 2020-09-09 15:39:33 +02:00
Zi Fan
ea1151d143
Escape environment vars in the default rarun profile (#17441) ##debug 2020-09-07 11:16:57 +02:00
David CARLIER
15e73666b2
Implements r_sys_aslr for NetBSD ##port (#17588)
ASLR on NetBSD is also settable via sysctl call.
2020-09-04 21:52:16 +02:00
pancake
052f97dd24
Fix #17506 - r2 http://example.org works again ##io (#17514) 2020-09-04 16:01:03 +02:00
Alexis Ehret
22482f6ac3
Fix 2 last critical LGTM errors (#17451)
Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2020-09-03 16:23:19 +08:00
Zi Fan
0ba897f5c9
Add network support for WinDbg/KD (KDNET) ##debug (#17340)
* Add network support for WinDbg/KD (KDNET) ##debug
* Add iob_net io_backend plugin for shlr/winkd
* Add Windows 10 (May 2019 Update) build 18362 profile
* Add r_hash_do_hmac_sha256 function to r_hash
* Change r_socket_connect to bind source port for UDP connection
2020-08-26 10:24:20 +08:00
Zi Fan
ac126508d5
Fix debugger to run debuggee with original environment variables ##debug (#17116)
* Change `fork_and_ptraceme` to start debuggee with rarun2 profile on Linux & Mac
* Add two new commands `doe` and `doe!` to show and edit rarun2 startup profile
* Fix `r_run_parse` to read last line
2020-07-24 16:25:55 +08:00
pancake
2b38b2f03c
Add more null checks and fix a lock when no r2 in path ##r2pipe (#16999)
Co-authored-by: pancake <pancake@nopcode.org>
Co-authored-by: Anton Kochkov <xvilka@gmail.com>
2020-07-24 16:24:19 +08:00
Riccardo Schirone
2d160f2509
Avoid sdb double headers (#17249) ##build
* Avoid duplication of SDB headers in libr/include

SDB is an external project and as such it should live in shlr. However,
for simplicity in dealing with the include flags, the SDB headers were
copied in libr/include as well. This patch just keeps the SDB files
confined in shlr/sdb and make sure various r_* libs use the headers from
there.

* Fix pkgconfig file generation
2020-07-21 10:28:43 +02:00
Riccardo Schirone
594b940b7c
Fixes some of the issues in Travis (#17267)
* Do not check with r_return_ if the convention is present

Let's just assume the NULL default in such a case, so that architectures
for which we don't have a defined calling convention can still be
processed somehow by the analysis code. It won't be precise, but it's
better than nothing.

Also add a warning message so users are aware when the calling
convention is not defined.

* Fix oob-read when # is at the end of the cmd string

* Do not set TMPDIR when the new value is the empty string

When TMPDIR is set to empty value, clang+ld behaves in weird ways and
you cannot compile files from within the r2 shell (e.g. when using #!c
or #!cpipe)

* Use meson and add -lasan to pkgconfig files when sanitizer are used
2020-07-16 20:47:30 +08:00
David CARLIER
5c71b01097
Support self:// for Solaris (#17196) ##io
enabled only on 64 bits unsupported on 32 bits with large files.
missing cfmakeraw function on this platform for socket et cons.
2020-07-03 18:59:24 +02: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
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
84ecf9fff2
Fix all the coverities detected last month (#17060)
* Fix all the coverities detected last month

* Fix one more cov

* Fix build

* refix build

Co-authored-by: pancake <pancake@nopcode.org>
2020-06-14 13:21:57 +02:00
Anton Kochkov
ffe743ef39
Fix #4056 - rename DEPS to R2DEPS ##build (#17020)
* Rename DEPS to R2DEPS
* Cleanup of sys/build.sh
2020-06-12 10:49:28 +08:00
GustavoLCR
04edfa82c1
Fix command injection on PDB download (#16966)
* Fix r_sys_mkdirp with absolute path on Windows
* Fix build with --with-openssl
* Use RBuffer in r_socket_http_answer()
* r_socket_http_answer: Fix read for big responses
* Implement r_str_escape_sh()
* Cleanup r_socket_connect() on Windows
* Fix socket being created without a protocol
* Fix socket connect with SSL ##socket
* Use select() in r_socket_ready()
* Fix read failing if received only protocol answer
* Fix double-free
* r_socket_http_get: Fail if req. SSL with no support
* Follow redirects in r_socket_http_answer()
* Fix r_socket_http_get result length with R2_CURL=1
* Also follow redirects
* Avoid using curl for downloading PDBs
* Use r_socket_http_get() on UNIXs
* Use WinINet API on Windows for r_socket_http_get()
* Fix command injection
* Fix r_sys_cmd_str_full output for binary data
* Validate GUID on PDB download
* Pass depth to socket_http_get_recursive()
* Remove 'r_' and '__' from static function names
* Fix is_valid_guid
* Fix for comments
2020-06-10 18:00:00 +02:00
Yusef Karim
6a0d90d2f5
Create writefds set to fix socket timeout in r_socket_connect (fixes #16788) (#16946)
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
2020-05-25 14:24:06 +08:00
Disconnect3d
179345644d
Fix string length in strncmp call of the http server (#16569) 2020-04-24 11:30:40 +02:00
pancake
e9d49c92f5 Fix build without forkpty (windows) 2020-04-20 17:04:30 +02:00
pancake
498292a70d Fix the static build by dynamically resolving libutil symbols ##build 2020-04-20 14:25:28 +02:00
pancake
315050e7ab Fix last coverities 2020-04-13 23:57:16 +02:00
Alexis Ehret
ef07476e38
Fix various lgtm warning (#16497)
* Wrong type of arguments to formatting function root/shlr/mpc/mpc.c
* Overflow in uncontrolled allocation size ./libr/socket/run.c
* Multiplication result converted to larger type ./libr/core/cmd_print.c
* Multiplication result converted to larger type ./libr/bin/p/bin_dyldcache.c
* Multiplication result converted to larger type ./libr/core/linux_heap_glibc.c
* Multiplication result converted to larger type ./libr/core/visual.c
* Comparison of narrow type with wide type in loop condition ./libr/core/p/core_java.c
* Fix various warning -Wall ./libr/core/p/core_java.c
* Multiplication result converted to larger type ./libr/bin/format/mach0/mach0.c
* Multiplication result converted to larger type ./libr/util/print.c
* Multiplication result converted to larger type ./libr/asm/asm.c
* Fix small warning python
* Fix type error and declaration inside loop
* Reset mpc
* replace size_t
* Fix space missing, type and format
2020-04-12 20:45:24 +02:00
pancake
54617455de
Initial refactoring of the rap:// protocol (-75 LOC) ##socket (#16534)
* It's implemented in IO, Socket and Core
* Remove duplicated apis and defines, everything in in RSocket now
* RIO now owns an RCoreBind instead of 3 fcn pointers + 1 void*
* Use proper filenames in libr/socket following public api names
* Use RSocket.block apis in the rap client + server apis
2020-04-12 16:40:55 +02:00
radare
5e4cdaaa04
Always use r_getopt, do not depend on libc (not just on windows) ##core (#16325) 2020-03-27 17:06:40 +01:00
yossizap
778c42cfa7
Fix socket connection issue (#16218) ##socket
PR #16073 exposed that the linux implementation of r_socket_is_connected
returned -1 from recv with errno set to EAGAIN. This broke gdbr and
probably other remote capabilities since r_socket_connect would fail.
I switched the implementation to getsockopt which is more reliable
instaed of playing with non blocking settings.
2020-03-15 11:56:55 +01:00
radare
5e629a3260
Avoidify the strTrim() APIs + cleanup/refactor ##util (#16056) 2020-03-02 21:39:37 +01:00
Paul I
0e62dda341
Fix fgets() usage (#16068) 2020-02-29 20:47:10 +01:00
radare
6ae8806411
Do not use the elvis operator for bool expressions (#16073) 2020-02-28 15:19:37 +01:00
Anton Kochkov
9ae41ae69f
Revert "Avoidify the RUtil.strTrim() APIs, rename trimHeadTail() and add asserts in RConfig ##refactor" (#16055)
This reverts commit 38b61c7bcfe55a727b9c3cedbc0f3147018e7c6b.
2020-02-26 09:59:04 +08:00
radare
38b61c7bcf
Avoidify the RUtil.strTrim() APIs, rename trimHeadTail() and add asserts in RConfig ##refactor 2020-02-25 17:53:09 +01:00
Anton Kochkov
d5d5cd3bfa
Some coverity fixes (#15643) 2019-12-16 04:36:46 -06:00
yossizap
ebfbf1a039 Fix r_socket_connect not using the given timeout in unix ##network
Connect isn't effected by r_socket_block_time since it can only change the
timeout of read(and not implemented, write) actions with setsockopt.
Also, connect may wait for an unspecified amount of time so we have to use
select.
2019-11-18 01:38:08 +01:00
dok
34e4bd7291 Use sigaction instead of signal ##core 2019-11-06 12:41:36 +01:00
Anton Kochkov
5aa127fe22 Fix build 2019-10-09 16:58:42 +08:00
pancake
6b6ea317f9 Handle free for R2pipe.open_dl() 2019-10-09 10:16:16 +02:00
pancake
596cbf2903 Implement r2pipe_open_dl() to use dlopen/dlsym ##r2pie 2019-10-09 00:42:24 +02:00
Paul I
64a6baf0a9 Use abs path for LIBDIR and INCLUDEDIR on Windows (#15096) 2019-09-22 10:42:49 +02:00
Paul I
016c1f73cb Add R_INVALID_SOCKET macro (#15094) 2019-09-22 00:32:35 +02:00
radare
e1cf65332a
Use r_sandbox_fopen instead of fopen (#14832) 2019-08-18 17:19:53 +02:00
radare
d8362da581
Fix timeout issue in http.get ##io 2019-07-23 18:32:48 +02:00