Enforce valid value for asm.offset.relto ##config

This commit is contained in:
pancake 2024-09-25 19:48:19 +02:00 committed by GitHub
parent 23223ee6f2
commit 2fba90530f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View File

@ -1612,10 +1612,18 @@ static bool cb_color_getter(void *user, RConfigNode *node) {
}
static bool cb_reloff(void *user, void *data) {
// RCore *core = (RCore *) user;
const char options[] = "func\nflag\nmaps\ndmap\nfmap\nsect\nsymb\nlibs\nfile\n";
RConfigNode *node = (RConfigNode *) data;
if (strchr (node->value, '?')) {
r_cons_printf ("func\nflag\nmaps\ndmap\nfmap\nsect\nsymb\nlibs\nfile\n");
if (*node->value) {
char *pos = strstr (options, node->value);
if (pos && pos[strlen (node->value)] == '\n') {
return true;
}
if (strchr (node->value, '?')) {
r_cons_printf (options);
} else {
R_LOG_ERROR ("Invalid value, try `-e asm.offset.relto=?`");
}
return false;
}
return true;

View File

@ -34,7 +34,7 @@ NAME=pd+reloff+colors
FILE=bins/elf/analysis/ls-alxchk
CMDS=<<EOF
af
e asm.offset.relto=fun
e asm.offset.relto=func
pd 10
e scr.color=1
pd 10