Fixed size truncation when checking for Interix types on 32-bit CPU

A cast, intended to avoid comparing signed to unsigned, led to truncate
the size on a 32-bit CPU, hence to wrongly check for Interix types.
This commit is contained in:
Jean-Pierre André 2013-05-07 11:42:48 +02:00
parent abba388447
commit db35a16838
2 changed files with 6 additions and 6 deletions

View File

@ -4,7 +4,7 @@
* Copyright (c) 2005-2007 Yura Pakhuchiy
* Copyright (c) 2005 Yuval Fledel
* Copyright (c) 2006-2009 Szabolcs Szakacsits
* Copyright (c) 2007-2012 Jean-Pierre Andre
* Copyright (c) 2007-2013 Jean-Pierre Andre
* Copyright (c) 2009 Erik Larsson
*
* This file is originated from the Linux-NTFS project.
@ -683,9 +683,9 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx,
* Check whether it's Interix symbolic link, block or
* character device.
*/
if ((size_t)na->data_size <= sizeof(INTX_FILE_TYPES)
if ((u64)na->data_size <= sizeof(INTX_FILE_TYPES)
+ sizeof(ntfschar) * PATH_MAX
&& (size_t)na->data_size >
&& (u64)na->data_size >
sizeof(INTX_FILE_TYPES)) {
INTX_FILE *intx_file;

View File

@ -4,7 +4,7 @@
* Copyright (c) 2005-2007 Yura Pakhuchiy
* Copyright (c) 2005 Yuval Fledel
* Copyright (c) 2006-2009 Szabolcs Szakacsits
* Copyright (c) 2007-2012 Jean-Pierre Andre
* Copyright (c) 2007-2013 Jean-Pierre Andre
* Copyright (c) 2009 Erik Larsson
*
* This file is originated from the Linux-NTFS project.
@ -792,9 +792,9 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf)
* Check whether it's Interix symbolic link, block or
* character device.
*/
if ((size_t)na->data_size <= sizeof(INTX_FILE_TYPES)
if ((u64)na->data_size <= sizeof(INTX_FILE_TYPES)
+ sizeof(ntfschar) * PATH_MAX
&& (size_t)na->data_size >
&& (u64)na->data_size >
sizeof(INTX_FILE_TYPES)
&& !stream_name_len) {