Skip to content

Commit d204ddb

Browse files
committed
Add limitation of memory
1 parent 5813d19 commit d204ddb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/debug-server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#define COMMAND_PORT 9545
66
#define GDBSERVER_PORT 9549
77

8-
#define VERSION "1.3.0"
8+
#define VERSION "1.3.1"
99

1010
#define COMMAND_GDB_REGISTER 0x01
1111
#define COMMAND_GDBSERVER_ATTACH 0x02

src/service.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <sys/personality.h>
99
#include <sys/ptrace.h>
1010
#include <sys/wait.h>
11+
#include <sys/resource.h>
1112
#include "debug-server.h"
1213

1314
int stopped = 0;
@@ -101,6 +102,7 @@ int ptrace_for_stopping_at_entry_point(pid_t pid)
101102

102103
int start_service(int client_sock)
103104
{
105+
struct rlimit limit;
104106

105107
if(!arg_opt_m && service_pid != -1)
106108
{
@@ -129,6 +131,10 @@ int start_service(int client_sock)
129131
}
130132
else if(service_pid == 0)
131133
{
134+
limit.rlim_cur = 0x100000000;
135+
limit.rlim_max = 0x100000000;
136+
CHECK(setrlimit(RLIMIT_AS, &limit) != -1);
137+
132138
CHECK(sigprocmask(SIG_SETMASK, &old_mask, NULL) != -1);
133139

134140
CHECK(prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0) != -1);

0 commit comments

Comments
 (0)