mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-05 05:39:22 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f6ea7b326f | |||
| 4492474f7e |
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user