Fix latest COVs

This commit is contained in:
pancake 2015-02-08 00:30:25 +01:00
parent 317a173d47
commit 7b597ea874
6 changed files with 18 additions and 17 deletions

View File

@ -4,7 +4,6 @@
|__\__|_|__|___/__|__|_\__\___\ |____(_)____/
* rafind2 : add support for unicode/widestring search
* libr/debug/p/drx.c <- not used .. debug must have a hw reg api for drx and gpio
* ah -> add hint to define calls that do not return
* rabin2 -x should not work on non-fatmach0 files

View File

@ -124,7 +124,6 @@ static x86newTokenType getToken(const char *str, int *begin, int *end) {
while (isspace(str[*begin]))
++(*begin);
if (!str[*begin]) { // null byte
*end = *begin;
return TT_EOF;
@ -918,13 +917,14 @@ static int assemble(RAsm *a, RAsmOp *ao, const char *str) {
ut64 offset = a->pc;
ut8 *data = ao->buf;
int pos = 0, nextpos;
x86newTokenType ttype;
char mnemonic[12];
int mnemonic_len;
int op_ind, mnemonic_len;
Opcode *opcode_ptr;
Operand operands[3];
// Parse mnemonic
getToken(str, &pos, &nextpos);
(void)getToken(str, &pos, &nextpos);
mnemonic_len = (nextpos - pos < sizeof(mnemonic) - 1) ?
nextpos - pos : sizeof(mnemonic) - 1;
strncpy(mnemonic, str + pos, mnemonic_len);
@ -932,8 +932,8 @@ static int assemble(RAsm *a, RAsmOp *ao, const char *str) {
pos = nextpos;
// Parse operands
int op_ind = 0;
x86newTokenType ttype = getToken(str, &pos, &nextpos);
op_ind = 0;
ttype = getToken(str, &pos, &nextpos);
while (op_ind < 3 && ttype != TT_EOF) {
// Read operand
pos += parseOperand(str + pos, &operands[op_ind++]);
@ -948,7 +948,6 @@ static int assemble(RAsm *a, RAsmOp *ao, const char *str) {
operands[op_ind].type = 0;
// Try to assemble: walk through table and find fitting instruction
Opcode *opcode_ptr;
for (opcode_ptr = opcodes; opcode_ptr - opcodes < sizeof(opcodes) / sizeof(Opcode); ++opcode_ptr) {
// Mnemonic match?
if (strncasecmp(mnemonic, opcode_ptr->mnemonic, strlen(mnemonic)))

View File

@ -655,9 +655,9 @@ static int init_type_code_str_struct(STypeCodeStr *type_coder_str)
type_coder_str->type_str = (char *) malloc(TYPE_STR_LEN * sizeof(char));
if (type_coder_str->type_str == NULL) {
res = 0;
return 0;
}
memset(type_coder_str->type_str, 0, TYPE_STR_LEN * sizeof(char));
memset (type_coder_str->type_str, 0, TYPE_STR_LEN * sizeof(char));
type_coder_str->curr_pos = 0; // strlen("unknown type");
// strncpy(type_coder_str->type_str, "unknown_type", type_coder_str->curr_pos);
@ -843,15 +843,17 @@ parse_microsoft_mangled_name_err:
EDemanglerErr microsoft_demangle(SDemangler *demangler, char **demangled_name)
{
EDemanglerErr err = eDemanglerErrOK;
char *sym = demangler->symbol;
char *sym;
// TODO: maybe get by default some sym_len and check it?
unsigned int sym_len = strlen(sym);
unsigned int sym_len;
if (demangler == 0) {
if (!demangler || !demangled_name) {
err = eDemanglerErrMemoryAllocation;
goto microsoft_demangle_err;
}
sym = demangler->symbol;
sym_len = strlen (sym);
if (sym[sym_len - 1] == 'Z') {
err = eDemanglerErrUnsupportedMangling;

View File

@ -35,7 +35,7 @@ static const char* r_vline_u[] = {
// TODO: what about using bit shifting and enum for keys? see libr/util/bitmap.c
// the problem of this is that the fields will be more opaque to bindings, but we will earn some bits
typedef struct r_disam_options_t {
char str[2048], strsub[2048];
char str[1024], strsub[1024];
int use_esil;
int show_color;
int colorop;
@ -436,7 +436,7 @@ static void handle_build_op_str (RCore *core, RDisasmState *ds) {
core->parser->varlist = r_anal_var_list;
r_parse_varsub (core->parser, f,
ds->opstr, ds->strsub, sizeof (ds->strsub));
if (ds->strsub && *ds->strsub) {
if (*ds->strsub) {
free (ds->opstr);
ds->opstr = strdup (ds->strsub);
}

View File

@ -1405,7 +1405,7 @@ R_API void r_core_visual_title (RCore *core, int color) {
if (sz == UT64_MAX) {
pcs[0] = 0;
} else {
if (pa>sz) {
if (!sz || pa>sz) {
pc = 0;
} else {
pc = ( pa * 100 ) / sz;

View File

@ -633,7 +633,8 @@ R_API void r_core_visual_mounts (RCore *core) {
/* Show */
if (mode == 0) {
if (list) {
r_list_free(list);
r_list_free (list);
list = NULL;
}
r_cons_printf ("Press '/' to navigate the root filesystem.\nPartitions:\n\n");
n = r_fs_partition_type_get (partition);