From 0bf4b29ff915fb87016453ddb771be01f4f0fcb3 Mon Sep 17 00:00:00 2001 From: pancake Date: Fri, 6 Oct 2023 16:15:45 +0200 Subject: [PATCH] fix r2 < 5.8.9 builds --- src/core_yara.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/core_yara.c b/src/core_yara.c index c43f069..d35763b 100644 --- a/src/core_yara.c +++ b/src/core_yara.c @@ -1,10 +1,21 @@ - - /* radare - LGPLv3 - Copyright 2014-2023 - pancake, jvoisin, jfrankowski */ #include #include +#if R2_VERSION_NUMBER <= 50809 +static inline char *r_str_after(char *s, char c) { + if (s) { + char *p = strchr (s, c); + if (p) { + *p++ = 0; + return p; + } + } + return NULL; +} +#endif + // TODO: remove globals! static R_TH_LOCAL bool initialized = false; static R_TH_LOCAL bool print_strings = false; @@ -585,12 +596,19 @@ static int cmd_yara_fini() { } RCorePlugin r_core_plugin_yara = { +#if R2_VERSION_NUMBER <= 50809 + .name = "yara", + .desc = "YARA integration", + .license = "LGPL", + .version = "0.1.2", +#else .meta = { .name = "yara", .desc = "YARA integration", .license = "LGPL", .version = "0.1.2", }, +#endif .call = cmd_yara_call, .init = cmd_yara_init, .fini = cmd_yara_fini