From aaf93c20d5141ed84b593c8f2697017b68ef9c6c Mon Sep 17 00:00:00 2001 From: radare Date: Fri, 19 Apr 2019 16:54:53 +0200 Subject: [PATCH] More improvements in the current flagtags and ftl->ftw ##flags --- libr/core/cmd_flag.c | 4 ++-- libr/flag/d/alloc | 2 +- libr/flag/d/crypto | 9 +++++++++ libr/flag/d/fs | 31 ++++++++++++++++++++++++++++++- libr/flag/d/meson.build | 2 ++ libr/flag/d/process | 4 ++++ libr/flag/d/stdout | 3 ++- libr/flag/d/threads | 7 +++++++ libr/flag/d/time | 20 ++++++++++++++++++++ libr/util/file.c | 3 +++ 10 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 libr/flag/d/crypto create mode 100644 libr/flag/d/threads create mode 100644 libr/flag/d/time diff --git a/libr/core/cmd_flag.c b/libr/core/cmd_flag.c index 35e09653a5..0acfad4d35 100644 --- a/libr/core/cmd_flag.c +++ b/libr/core/cmd_flag.c @@ -243,12 +243,12 @@ static void cmd_flag_tags (RCore *core, const char *input) { eprintf (" ft tag strcpy strlen ... # set words for the 'string' tag\n"); eprintf (" ft tag # get offsets of all matching flags\n"); eprintf (" ft # list all tags\n"); - eprintf (" ftl # list all tags and the associated flags\n"); eprintf (" ftn tag # get matching flagnames fot given tag\n"); + eprintf (" ftw # flag tags within this file\n"); free (inp); return; } - if (mode == 'l') { + if (mode == 'w') { // "ftw" const char *tag; RListIter *iter; RList *list = r_flag_tags_list (core->flags); diff --git a/libr/flag/d/alloc b/libr/flag/d/alloc index 3e7ec3cc6f..93c9fbd692 100644 --- a/libr/flag/d/alloc +++ b/libr/flag/d/alloc @@ -1,5 +1,5 @@ malloc -free +free$ calloc kalloc realloc diff --git a/libr/flag/d/crypto b/libr/flag/d/crypto new file mode 100644 index 0000000000..0b3e8a5424 --- /dev/null +++ b/libr/flag/d/crypto @@ -0,0 +1,9 @@ +encrypt +decrypt +aes +AES +blowfish +_des +_rc2 +serpent +_cbc diff --git a/libr/flag/d/fs b/libr/flag/d/fs index 406e2735f2..423662f35d 100644 --- a/libr/flag/d/fs +++ b/libr/flag/d/fs @@ -1,4 +1,33 @@ -open +open$ close read$ write +CloseHandle +FindFirstFileW +_wfopen +_wstat +ftruncate +lseek +_chsize +GetFullPathName +realpath +RemoveDirectory +DeleteFile +CreateFile +WriteFile +UnmapViewOfFile +CreateFileMapping +MapViewOfFile +readlink +chmod +fchmod +chown +stat +fstat +lstat +fstatat +lstat64 +stat64 +chflags +fchflags +lchflags diff --git a/libr/flag/d/meson.build b/libr/flag/d/meson.build index 0ecd10e5e2..d81b9e48cf 100644 --- a/libr/flag/d/meson.build +++ b/libr/flag/d/meson.build @@ -1,9 +1,11 @@ tags_r2_sources = [ 'dylib', 'alloc', + 'time', 'env', 'fs', 'network', + 'threads', 'process', 'stdout', 'string' diff --git a/libr/flag/d/process b/libr/flag/d/process index 7a0a0c365c..8ab343d734 100644 --- a/libr/flag/d/process +++ b/libr/flag/d/process @@ -1,5 +1,9 @@ getpid +getppid kill exit abort assert +gethostid +sethostid +sysctl diff --git a/libr/flag/d/stdout b/libr/flag/d/stdout index 2dd2515c46..4c3610fe10 100644 --- a/libr/flag/d/stdout +++ b/libr/flag/d/stdout @@ -1,2 +1,3 @@ -printf +^printf puts +write diff --git a/libr/flag/d/threads b/libr/flag/d/threads new file mode 100644 index 0000000000..0cad7cbb2a --- /dev/null +++ b/libr/flag/d/threads @@ -0,0 +1,7 @@ +pthread_create +pthread_mutex_init +pthread_cond_init +CreateThread +TerminateThread +WaitForSingleObject +GetCurrentThreadId diff --git a/libr/flag/d/time b/libr/flag/d/time new file mode 100644 index 0000000000..3e79b33bfa --- /dev/null +++ b/libr/flag/d/time @@ -0,0 +1,20 @@ +settimeofday +gettimeofday +time +adjtime +ctime +timed +date$ +sleep +Sleep +usleep +clock_nanosleep +localtime +asctime +difftime +gmtime +mktime +timelocal +timegm +tzfile +tzset diff --git a/libr/util/file.c b/libr/util/file.c index 83a4029b12..5031132322 100644 --- a/libr/util/file.c +++ b/libr/util/file.c @@ -763,6 +763,9 @@ R_API int r_file_mmap_read (const char *file, ut64 addr, ut8 *buf, int len) { goto err_r_file_mmap_read; } ut8 *obuf = MapViewOfFile (fm, FILE_MAP_READ, 0, 0, len); + if (!obuf) { + goto err_r_file_mmap_read; + } memcpy (obuf, buf, len); UnmapViewOfFile (obuf); ret = len;