diff -up ntfs-3g_ntfsprogs-2017.3.23/src/lowntfs-3g.c.CVE-2019-9755 ntfs-3g_ntfsprogs-2017.3.23/src/lowntfs-3g.c --- ntfs-3g_ntfsprogs-2017.3.23/src/lowntfs-3g.c.CVE-2019-9755 2019-03-29 16:08:22.359920075 -0400 +++ ntfs-3g_ntfsprogs-2017.3.23/src/lowntfs-3g.c 2019-03-29 16:08:28.237794169 -0400 @@ -4323,7 +4323,8 @@ int main(int argc, char *argv[]) else { ctx->abs_mnt_point = (char*)ntfs_malloc(PATH_MAX); if (ctx->abs_mnt_point) { - if (getcwd(ctx->abs_mnt_point, + if ((strlen(opts.mnt_point) < PATH_MAX) + && getcwd(ctx->abs_mnt_point, PATH_MAX - strlen(opts.mnt_point) - 1)) { strcat(ctx->abs_mnt_point, "/"); strcat(ctx->abs_mnt_point, opts.mnt_point); @@ -4331,6 +4332,9 @@ int main(int argc, char *argv[]) /* Solaris also wants the absolute mount point */ opts.mnt_point = ctx->abs_mnt_point; #endif /* defined(__sun) && defined (__SVR4) */ + } else { + free(ctx->abs_mnt_point); + ctx->abs_mnt_point = (char*)NULL; } } } diff -up ntfs-3g_ntfsprogs-2017.3.23/src/ntfs-3g.c.CVE-2019-9755 ntfs-3g_ntfsprogs-2017.3.23/src/ntfs-3g.c --- ntfs-3g_ntfsprogs-2017.3.23/src/ntfs-3g.c.CVE-2019-9755 2019-03-29 16:08:54.691227528 -0400 +++ ntfs-3g_ntfsprogs-2017.3.23/src/ntfs-3g.c 2019-03-29 16:09:40.362249397 -0400 @@ -4123,7 +4123,8 @@ int main(int argc, char *argv[]) else { ctx->abs_mnt_point = (char*)ntfs_malloc(PATH_MAX); if (ctx->abs_mnt_point) { - if (getcwd(ctx->abs_mnt_point, + if ((strlen(opts.mnt_point) < PATH_MAX) + && getcwd(ctx->abs_mnt_point, PATH_MAX - strlen(opts.mnt_point) - 1)) { strcat(ctx->abs_mnt_point, "/"); strcat(ctx->abs_mnt_point, opts.mnt_point); @@ -4131,6 +4132,9 @@ int main(int argc, char *argv[]) /* Solaris also wants the absolute mount point */ opts.mnt_point = ctx->abs_mnt_point; #endif /* defined(__sun) && defined (__SVR4) */ + } else { + free(ctx->abs_mnt_point); + ctx->abs_mnt_point = (char*)NULL; } } }