diff --git a/libr/core/cmd_meta.inc.c b/libr/core/cmd_meta.inc.c index 5d714c57802a5..d515913776b74 100644 --- a/libr/core/cmd_meta.inc.c +++ b/libr/core/cmd_meta.inc.c @@ -605,7 +605,17 @@ static int cmd_meta_comment(RCore *core, const char *input) { case '+': case ' ': { - const char *newcomment = r_str_trim_head_ro (input + 2); + const char *arg = r_str_trim_head_ro (input + 2); + const char *newcomment = arg; + if (r_str_startswith (arg, "base64:")) { + char *s = (char *)sdb_decode (arg + 7, NULL); + if (s) { + newcomment = s; + } else { + R_LOG_ERROR ("Invalid base64 string"); + break; + } + } const char *comment = r_meta_get_string (core->anal, R_META_TYPE_COMMENT, addr); char *text; char *nc = strdup (newcomment); @@ -655,7 +665,7 @@ static int cmd_meta_comment(RCore *core, const char *input) { char *newcomment; const char *arg = input + 2; while (*arg && *arg == ' ') arg++; - if (!strncmp (arg, "base64:", 7)) { + if (r_str_startswith (arg, "base64:")) { char *s = (char *)sdb_decode (arg + 7, NULL); if (s) { newcomment = s; diff --git a/libr/crypto/p/crypto_xor.c b/libr/crypto/p/crypto_xor.c index 2251642729b3d..3226ea2f6a021 100644 --- a/libr/crypto/p/crypto_xor.c +++ b/libr/crypto/p/crypto_xor.c @@ -18,6 +18,9 @@ static bool xor_init(struct xor_state *const state, const ut8 *key, int keylen) } state->key_size = keylen; state->key = malloc (keylen); + if (state->key == NULL) { + return false; + } memcpy (state->key, key, keylen); return true; } @@ -27,7 +30,7 @@ static bool xor_init(struct xor_state *const state, const ut8 *key, int keylen) */ static void xor_crypt(struct xor_state *const state, const ut8 *inbuf, ut8 *outbuf, int buflen) { - int i;//index for input + int i; for (i = 0; i < buflen; i++) { outbuf[i] = inbuf[i] ^ state->key[(i%state->key_size)]; }