Skip to content

Commit

Permalink
Add base64 for CC (not only CCu) ##shell
Browse files Browse the repository at this point in the history
  • Loading branch information
radare authored and trufae committed Mar 21, 2024
1 parent 8ab4d39 commit 116b4a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
14 changes: 12 additions & 2 deletions libr/core/cmd_meta.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion libr/crypto/p/crypto_xor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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)];
}
Expand Down

0 comments on commit 116b4a5

Please sign in to comment.