mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-09 11:53:39 +00:00
Fix some buffer overflow
This commit is contained in:
parent
cd9fd5ce29
commit
359846b0d1
@ -274,7 +274,7 @@ static int use_stdin () {
|
||||
static char buf[STDIN_BUFFER_SIZE];
|
||||
int l, sflag = (flags & 5);
|
||||
for (l=0; l>=0; l++) {
|
||||
int n = read (0, buf+l, sizeof (buf)-l);
|
||||
int n = read (0, buf+l, sizeof (buf)-l-1);
|
||||
if (n<1) break;
|
||||
l+= n;
|
||||
if (buf[l-1]==0) {
|
||||
|
@ -87,7 +87,7 @@ R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut6
|
||||
return NULL;
|
||||
}
|
||||
tokens[0] = NULL;
|
||||
for (tokcount=0; tokcount<sizeof (tokens)-1; tokcount++) {
|
||||
for (tokcount=0; tokcount<(sizeof (tokens) / sizeof (char*)) - 1; tokcount++) {
|
||||
tok = strtok (tokcount? NULL: ptr, ",");
|
||||
if (tok == NULL)
|
||||
break;
|
||||
|
@ -363,7 +363,7 @@ static int autocomplete(RLine *line) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
tmp_argv[i] = NULL;
|
||||
tmp_argv[i>255?255:i] = NULL;
|
||||
line->completion.argc = i;
|
||||
line->completion.argv = tmp_argv;
|
||||
} else
|
||||
|
@ -1213,7 +1213,7 @@ static void handle_print_indent (RCore *core, RDisasmState *ds) {
|
||||
char indent[128];
|
||||
int num = ds->indent_level;
|
||||
if (num<0) num = 0;
|
||||
if (num>sizeof (indent))
|
||||
if (num>=sizeof (indent))
|
||||
num = sizeof(indent)-1;
|
||||
memset (indent, ' ', num);
|
||||
indent[num] = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user