diff --git a/binr/rax2/rax2.c b/binr/rax2/rax2.c index 1f752b18d8..01673c52b8 100644 --- a/binr/rax2/rax2.c +++ b/binr/rax2/rax2.c @@ -390,9 +390,9 @@ static int rax (char *str, int len, int last) { static int use_stdin () { char * buf = calloc (1, STDIN_BUFFER_SIZE + 1); + int l; //, sflag = (flags & 5); if (!buf) return 0; - int l, sflag = (flags & 5); if (!(flags & 16384)) { for (l = 0; l >= 0 && l < STDIN_BUFFER_SIZE; l++) { //make sure we don't read beyond boundaries diff --git a/libr/anal/p/anal_x86_cs.c b/libr/anal/p/anal_x86_cs.c index 83a42da4cd..f3e6cb6e04 100644 --- a/libr/anal/p/anal_x86_cs.c +++ b/libr/anal/p/anal_x86_cs.c @@ -1956,7 +1956,6 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { (a->bits==32)? CS_MODE_32: (a->bits==16)? CS_MODE_16: 0; int n, ret; - int regsz = 4; if (handle && mode != omode) { cs_close (&handle); @@ -1970,15 +1969,6 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { return 0; } } -#if 0 - if (len>3 && !memcmp (buf, "\xff\xff\xff\xff", 4)) - return 0; -#endif - switch (a->bits) { - case 64: regsz = 8; break; - case 16: regsz = 2; break; - default: regsz = 4; break; // 32 - } memset (op, '\0', sizeof (RAnalOp)); op->cycles = 1; // aprox op->type = R_ANAL_OP_TYPE_NULL; @@ -2004,21 +1994,13 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { #else n = cs_disasm (handle, (const ut8*)buf, len, addr, 1, &insn); #endif - struct Getarg gop = { - .handle = handle, - .insn = insn, - .bits = a->bits - }; if (n<1) { op->type = R_ANAL_OP_TYPE_ILL; } else { - int rs = a->bits/8; - const char *pc = (a->bits==16)?"ip": - (a->bits==32)?"eip":"rip"; - const char *sp = (a->bits==16)?"sp": - (a->bits==32)?"esp":"rsp"; - const char *bp = (a->bits==16)?"bp": - (a->bits==32)?"ebp":"rbp"; + // int rs = a->bits / 8; + //const char *pc = (a->bits==16)?"ip": (a->bits==32)?"eip":"rip"; + //const char *sp = (a->bits==16)?"sp": (a->bits==32)?"esp":"rsp"; + //const char *bp = (a->bits==16)?"bp": (a->bits==32)?"ebp":"rbp"; op->size = insn->size; op->family = R_ANAL_OP_FAMILY_CPU; // almost everything is CPU op->prefix = 0; diff --git a/libr/asm/arch/mips/mipsasm.c b/libr/asm/arch/mips/mipsasm.c index 87847e152f..1dd0ae304d 100644 --- a/libr/asm/arch/mips/mipsasm.c +++ b/libr/asm/arch/mips/mipsasm.c @@ -106,7 +106,6 @@ static int mips_j (ut8 *b, int op, int addr) { static int getreg (const char *p) { int n; - char **tmp; if (!p || !*p) { eprintf ("Missing argument\n"); diff --git a/libr/bin/format/pe/pe.c b/libr/bin/format/pe/pe.c index e64f90891a..8c70501b41 100644 --- a/libr/bin/format/pe/pe.c +++ b/libr/bin/format/pe/pe.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2008-2015 nibble, pancake, inisider */ +/* radare - LGPL - Copyright 2008-2016 nibble, pancake, inisider */ #include #include @@ -2202,10 +2202,9 @@ struct r_bin_pe_import_t* PE_(r_bin_pe_get_imports)(struct PE_(r_bin_pe_obj_t) * dll_name[PE_NAME_LENGTH] = '\0'; if (!bin_pe_parse_imports (bin, &imports, &nimp, dll_name, - import_func_name_offset, - curr_delay_import_dir->DelayImportAddressTable)) + import_func_name_offset, curr_delay_import_dir->DelayImportAddressTable)) break; - if (curr_delay_import_dir + sizeof(curr_delay_import_dir) > bin->b->buf + bin->size) { + if ((size_t)(curr_delay_import_dir - off) + sizeof (curr_delay_import_dir) > bin->size) { eprintf ("Warning: malformed pe\n"); return NULL; } diff --git a/libr/crypto/p/crypto_aes.c b/libr/crypto/p/crypto_aes.c index 92fe0bab3d..611559a756 100644 --- a/libr/crypto/p/crypto_aes.c +++ b/libr/crypto/p/crypto_aes.c @@ -15,11 +15,11 @@ static int aes_set_key (RCrypto *cry, const ut8 *key, int keylen, int mode, int st.columns = (int)(keylen / 4); memcpy(st.key, key, keylen); - // printf("*** State:\n \ - // Key: %s\n \ - // Received keylen: %d\t\tkey_size: %d\n \ - // columns: %d\n \ - // rounds: %d\n \ + // printf("*** State:\n + // Key: %s\n + // Received keylen: %d\t\tkey_size: %d\n + // columns: %d\n + // rounds: %d\n // Finished!\n", st.key, keylen, st.key_size, st.columns, st.rounds); return true; } @@ -56,10 +56,10 @@ static int update (RCrypto *cry, const ut8 *buf, int len) { ibuf[len] = 0b1000; } - // printf("*** State:\n \ - // Key: %s\n \ - // key_size: %d\n \ - // columns: %d\n \ + // printf("*** State:\n + // Key: %s\n + // key_size: %d\n + // columns: %d\n // rounds: %d\n", st.key, st.key_size, st.columns, st.rounds); int i; for (i = 0; i < blocks; i++) { diff --git a/libr/crypto/p/crypto_rc2.c b/libr/crypto/p/crypto_rc2.c index 2a05cd89c1..f570000e7c 100644 --- a/libr/crypto/p/crypto_rc2.c +++ b/libr/crypto/p/crypto_rc2.c @@ -156,8 +156,8 @@ static void rc2_dcrypt(struct rc2_state *state, const ut8 *inbuf, ut8 *outbuf, i data_block[idx] = inbuf[i]; idx += 1; if (idx % BLOCK_SIZE == 0) { - rc2_dcrypt8(state, (const ut8 *) data_block, (ut8 *) dcrypted_block); - strncpy(ptr, dcrypted_block, BLOCK_SIZE); + rc2_dcrypt8 (state, (const ut8 *) data_block, (ut8 *) dcrypted_block); + strncpy (ptr, dcrypted_block, BLOCK_SIZE); ptr += BLOCK_SIZE; idx = 0; } diff --git a/libr/crypto/p/crypto_rot.c b/libr/crypto/p/crypto_rot.c index ff0742198b..8aa62dc985 100644 --- a/libr/crypto/p/crypto_rot.c +++ b/libr/crypto/p/crypto_rot.c @@ -13,12 +13,12 @@ int mod(int a, int b) { } static bool rot_init(ut8 *rotkey, const ut8 *key, int keylen) { - if (!rotkey || !key) { - return false; + if (rotkey && key && keylen > 0) { + int i = atoi ((const char *)key); + *rotkey = (ut8)mod (i, 26); + return true; } - int i = atoi(key); - *rotkey = (ut8)mod(i, 26); - return true; + return false; } static void rot_crypt(ut8 key, const ut8 *inbuf, ut8 *outbuf, int buflen) { diff --git a/libr/debug/p/debug_bochs.c b/libr/debug/p/debug_bochs.c index 6724e9cdd0..ceea96818d 100644 --- a/libr/debug/p/debug_bochs.c +++ b/libr/debug/p/debug_bochs.c @@ -77,7 +77,7 @@ static int r_debug_bochs_reg_read(RDebug *dbg, int type, ut8 *buf, int size) { char strBase[19]; char strLimit[19]; int i = 0, pos = 0, lenRec = 0; - ut64 val = 0, valRIP = 0, posRIP = 0; + ut64 val = 0, valRIP = 0; //, posRIP = 0; //eprintf ("bochs_reg_read\n"); if (bCapturaRegs == true) { @@ -92,18 +92,18 @@ static int r_debug_bochs_reg_read(RDebug *dbg, int type, ut8 *buf, int size) { if ( (desc->data[i] == (ut8)'r' && desc->data[i + 3] == (ut8)':')) { strncpy (regname, &desc->data[i], 3); regname[3] = 0; - strncpy(&strReg[2], &desc->data[i + 5], 8); - strncpy(&strReg[10], &desc->data[i + 14], 8); + strncpy (&strReg[2], &desc->data[i + 5], 8); + strncpy (&strReg[10], &desc->data[i + 14], 8); strReg[0]='0'; strReg[1]='x'; strReg[18] = 0; i += 22; - val = r_num_get (NULL,strReg); + val = r_num_get (NULL, strReg); // eprintf("parseado %s = %s valx64 = %016"PFMT64x"\n", regname, strReg,val); - memcpy (&buf[pos],&val,8); + memcpy (&buf[pos], &val, 8); // guardamos la posicion del rip y su valor para ajustarlo al obtener el CS - if (!strncmp (regname,"rip",3)) { - posRIP = pos; + if (!strncmp (regname, "rip", 3)) { + // UNUSED posRIP = pos; valRIP = val; } pos+= 8; @@ -140,7 +140,7 @@ static int r_debug_bochs_reg_read(RDebug *dbg, int type, ut8 *buf, int size) { gdtr:base=0x0000000000000000, limit=0xffff idtr:base=0x0000000000000000, limit=0xffff */ - bochs_send_cmd (desc,"sreg",true); + bochs_send_cmd (desc, "sreg", true); pos = 0x38; char * s [] = { "es:0x", "cs:0x","ss:0x","ds:0x","fs:0x","gs:0x",0}; @@ -173,10 +173,11 @@ static int r_debug_bochs_reg_read(RDebug *dbg, int type, ut8 *buf, int size) { } } // Cheat para evitar traducciones de direcciones - if (ripStop!=0) + if (ripStop != 0) { memcpy (&buf[0], &ripStop, 8); - else + } else { memcpy (&buf[0], &valRIP, 8); // guardamos el valor cs:ip en el registro virtual "vip" + } //eprintf("guardando regs procesados%x\n",size); memcpy (saveRegs,buf,size); bCapturaRegs = false; @@ -192,12 +193,12 @@ static int r_debug_bochs_reg_write(RDebug *dbg, int type, const ut8 *buf, int si //eprintf("bochs_reg_write\n"); return -1; } + void map_free(RDebugMap *map) { free (map->name); free (map); } - static RList *r_debug_bochs_map_get(RDebug* dbg) { //TODO //eprintf("bochs_map_getdebug:\n"); RDebugMap *mr; @@ -302,7 +303,6 @@ static int r_debug_bochs_stop(RDebug *dbg) { return true; } - static int r_debug_bochs_attach(RDebug *dbg, int pid) { RIODesc *d = dbg->iob.io->desc; //eprintf ("bochs_attach:\n"); @@ -334,7 +334,7 @@ static const char *r_debug_bochs_reg_profile(RDebug *dbg) { int bits = dbg->anal->bits; if (bits == 16 || bits == 32 || bits == 64) { - return strdup( + return strdup ( "=PC csip\n" "=SP rsp\n" "=BP rbp\n" @@ -514,7 +514,6 @@ static const char *r_debug_bochs_reg_profile(RDebug *dbg) { RDebugPlugin r_debug_plugin_bochs = { .name = "bochs", - /* TODO: Add support for more architectures here */ .license = "LGPL3", .arch = "x86", .bits = R_SYS_BITS_16 | R_SYS_BITS_32 | R_SYS_BITS_64, @@ -530,8 +529,6 @@ RDebugPlugin r_debug_plugin_bochs = { .reg_read = &r_debug_bochs_reg_read, .reg_write = &r_debug_bochs_reg_write, .reg_profile = (void *)r_debug_bochs_reg_profile, - //.bp_write = &r_debug_gdb_bp_write, - //.bp_read = &r_debug_gdb_bp_read, }; #ifndef CORELIB diff --git a/sys/release-notes.js b/sys/release-notes.js index 998d0bbef8..eebedf82df 100644 --- a/sys/release-notes.js +++ b/sys/release-notes.js @@ -154,7 +154,7 @@ for (let paz of paths) { r.diff = d; doner.push (r); count --; - if (count == 0) { + if (count == 0 && ready) { console.log (JSON.stringify (doner)); } });