Skip to content

Instantly share code, notes, and snippets.

@karliss
Created February 25, 2020 20:00
Show Gist options
  • Save karliss/bf9fbb03faab293ade01a0c7f957d475 to your computer and use it in GitHub Desktop.
Save karliss/bf9fbb03faab293ade01a0c7f957d475 to your computer and use it in GitHub Desktop.
diff --git a/radare2/libr/util/strbuf.c b/radare2/libr/util/strbuf.c
index 01bde8c37..7791412ba 100644
--- a/radare2/libr/util/strbuf.c
+++ b/radare2/libr/util/strbuf.c
@@ -213,6 +213,11 @@ R_API bool r_strbuf_append_n(RStrBuf *sb, const char *s, int l) {
R_FREE (sb->ptr);
} else {
int newlen = sb->len + l + 128;
+ if (newlen < INT_MAX / 2) {
+ newlen *= 2;
+ } else {
+ newlen = INT_MAX - 1024;
+ }
char *p = sb->ptr;
bool allocated = true;
if (!sb->ptr) {
diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp
index 26adeec..6ab0282 100644
--- a/src/core/Cutter.cpp
+++ b/src/core/Cutter.cpp
@@ -445,7 +445,11 @@ QJsonDocument CutterCore::parseJson(const char *res, const char *cmd)
} else {
eprintf("Failed to parse JSON: %s\n", jsonError.errorString().toLocal8Bit().constData());
}
- eprintf("%s\n", json.constData());
+ if (json.length() < 16*1024) {
+ eprintf("%s\n", json.constData());
+ } else {
+ eprintf("JSON size %d\n", json.length());
+ }
}
return doc;
@@ -535,7 +539,7 @@ bool CutterCore::loadFile(QString path, ut64 baddr, ut64 mapaddr, int perms, int
}
ut64 hashLimit = getConfigut64("cfg.hashlimit");
- r_bin_file_hash(core->bin, hashLimit, path.toUtf8().constData(), NULL);
+ //r_bin_file_hash(core->bin, hashLimit, path.toUtf8().constData(), NULL);
fflush(stdout);
return true;
diff --git a/src/widgets/ConsoleWidget.cpp b/src/widgets/ConsoleWidget.cpp
index b1e1024..d938e0d 100644
--- a/src/widgets/ConsoleWidget.cpp
+++ b/src/widgets/ConsoleWidget.cpp
@@ -419,6 +419,7 @@ void ConsoleWidget::redirectOutput()
addOutput("Run cutter in a console to enable r2 output redirection into this widget.");
return;
}
+ return;
pipeSocket = new QLocalSocket(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment