Skip to content

Commit

Permalink
Fix #1938 - Workaround for cg /dev/urandom crash
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Jan 17, 2015
1 parent 672b705 commit 1ccd0e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 2 additions & 3 deletions libr/cons/cons.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2008-2014 - pancake */
/* radare - LGPL - Copyright 2008-2015 - pancake */

#include <r_cons.h>
#include <r_print.h>
Expand Down Expand Up @@ -350,8 +350,7 @@ R_API void r_cons_flush() {
r_cons_filter ();
if (I.is_interactive) {
/* Use a pager if the output doesn't fit on the terminal window. */
if (I.pager && *(I.pager)
&& I.buffer_len > 0
if (I.pager && *I.pager && I.buffer_len > 0
&& r_str_char_count (I.buffer, '\n') >= I.rows) {
I.buffer[I.buffer_len-1] = 0;
r_sys_cmd_str_full (I.pager, I.buffer, NULL, NULL, NULL);
Expand Down
8 changes: 5 additions & 3 deletions libr/core/cmd_cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,17 +415,17 @@ static int cmd_cmp(void *data, const char *input) {
free (b);
}
break;
case 'g':
case 'g': // "cg"
{ // XXX: this is broken
int diffops = 0;
RCore *core2;
char *file2 = NULL;
switch (input[1]) {
case 'o':
case 'o': // "cgo"
file2 = (char*)r_str_chop_ro (input+2);
r_anal_diff_setup (core->anal, R_TRUE, -1, -1);
break;
case 'f':
case 'f': // "cgf"
eprintf ("TODO: agf is experimental\n");
r_anal_diff_setup (core->anal, R_TRUE, -1, -1);
r_core_gdiff_fcn (core, core->offset,
Expand Down Expand Up @@ -470,6 +470,8 @@ static int cmd_cmp(void *data, const char *input) {
r_config_get_i (core->config, "bin.baddr"));
r_core_gdiff (core, core2, 1);
r_core_diff_show (core, core2);
/* exchange a segfault with a memleak */
core2->config = NULL;
r_core_free (core2);
}
break;
Expand Down

0 comments on commit 1ccd0e3

Please sign in to comment.