Compare commits

..

2 Commits

2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -1,5 +1,7 @@
#include "config.h"
#include <memory>
#include "rpc/exec_file.h"
// #include <cassert>
@@ -81,8 +83,9 @@ ExecFile::execute_object(const torrent::Object& rawArgs, int flags) {
char* argsBuffer[max_args];
char** argsCurrent = argsBuffer;
// Size of value strings are less than 24.
char valueBuffer[buffer_size+1];
// On the heap: a buffer of buffer_size does not belong on the stack of whichever thread runs the command.
auto valueStorage = std::make_unique<char[]>(buffer_size + 1);
char* valueBuffer = valueStorage.get();
char* valueCurrent = valueBuffer;
if (rawArgs.is_list()) {
+1 -1
View File
@@ -10,7 +10,7 @@ namespace rpc {
class ExecFile {
public:
static constexpr unsigned int max_args = 128;
static constexpr unsigned int buffer_size = 4096;
static constexpr unsigned int buffer_size = 128 * 1024;
static constexpr int flag_expand_tilde = 0x1;
static constexpr int flag_throw = 0x2;