mcexec: PATH_MAX buffer lenght in do_generic_syscall()

This commit is contained in:
Balazs Gerofi
2016-12-25 17:20:14 +09:00
parent b836b84825
commit 829aae7b8d

View File

@@ -1746,8 +1746,8 @@ do_generic_syscall(
/* Overlayfs /sys/X directory lseek() problem work around */ /* Overlayfs /sys/X directory lseek() problem work around */
if (w->sr.number == __NR_lseek && ret == -EINVAL) { if (w->sr.number == __NR_lseek && ret == -EINVAL) {
char proc_path[512]; char proc_path[PATH_MAX];
char path[512]; char path[PATH_MAX];
struct stat sb; struct stat sb;
sprintf(proc_path, "/proc/self/fd/%d", (int)w->sr.args[0]); sprintf(proc_path, "/proc/self/fd/%d", (int)w->sr.args[0]);
@@ -1756,6 +1756,7 @@ do_generic_syscall(
if (readlink(proc_path, path, sizeof(path)) < 0) { if (readlink(proc_path, path, sizeof(path)) < 0) {
fprintf(stderr, "%s: error: readlink() failed for %s\n", fprintf(stderr, "%s: error: readlink() failed for %s\n",
__FUNCTION__, proc_path); __FUNCTION__, proc_path);
perror(": ");
goto out; goto out;
} }