smbd: Fix a signed/unsigned warning
authorVolker Lendecke <vl@samba.org>
Tue, 30 Jul 2019 05:10:28 +0000 (07:10 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 6 Aug 2019 21:49:28 +0000 (21:49 +0000)
For whatever reason, "st_size" in "struct stat" is an off_t, which is a
signed integer. Negative sizes don't really make sense, so this cast
should be safe.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c

index ee6de028a264306c4942abd1f3bb203c3d62c518..c81696d3831fa58f47bb883e844861311c7173f3 100644 (file)
@@ -5304,7 +5304,7 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
 
        /* Save the requested allocation size. */
        if ((info == FILE_WAS_CREATED) || (info == FILE_WAS_OVERWRITTEN)) {
-               if ((allocation_size > fsp->fsp_name->st.st_ex_size)
+               if ((allocation_size > (uint64_t)fsp->fsp_name->st.st_ex_size)
                    && !(fsp->is_directory))
                {
                        fsp->initial_allocation_size = smb_roundup(