From f4744df2fdf2b1ec0b87e0846dbc67db678450fc Mon Sep 17 00:00:00 2001 From: Andi McClure Date: Mon, 23 Nov 2015 14:33:44 -0500 Subject: [PATCH] Fix sys-stat.c where a pointer to a mode_t (potentially an int16) was being unsafely converted to an int32 pointer --- support/sys-stat.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/support/sys-stat.c b/support/sys-stat.c index 52ab1cf46898e..d71d555b4d1b1 100644 --- a/support/sys-stat.c +++ b/support/sys-stat.c @@ -30,9 +30,13 @@ Mono_Posix_FromStat (struct Mono_Posix_Stat *from, void *_to) to->st_dev = from->st_dev; to->st_ino = from->st_ino; - if (Mono_Posix_FromFilePermissions (from->st_mode, &to->st_mode) != 0) { + + unsigned int to_st_mode; + if (Mono_Posix_FromFilePermissions (from->st_mode, &to_st_mode) != 0) { return -1; } + + to->st_mode = to_st_mode; to->st_nlink = from->st_nlink; to->st_uid = from->st_uid; to->st_gid = from->st_gid;