From 85b39215b7264022460d3895e755e337485807b8 Mon Sep 17 00:00:00 2001 From: midipix Date: Jan 30 2017 04:57:20 +0000 Subject: {i}stat{fs} interfaces(): hold the operating system's hand as needed. --- diff --git a/src/fs/ntapi_tt_istat.c b/src/fs/ntapi_tt_istat.c index f17c8b1..67545a0 100644 --- a/src/fs/ntapi_tt_istat.c +++ b/src/fs/ntapi_tt_istat.c @@ -39,6 +39,10 @@ int32_t __stdcall __ntapi_tt_istat( istat->hfile = hfile; istat->dev_name_maxlen = (uint16_t)infolen - sizeof(*istat); + /* sigh */ + if (buffer_size >= 65536) + buffer_size = 65535; + /* file index number */ if (!(flags & NT_ISTAT_DEV_NAME_ONLY)) if ((status = __ntapi->zw_query_information_file( diff --git a/src/fs/ntapi_tt_stat.c b/src/fs/ntapi_tt_stat.c index 762535f..4d40fba 100644 --- a/src/fs/ntapi_tt_stat.c +++ b/src/fs/ntapi_tt_stat.c @@ -39,6 +39,10 @@ int32_t __stdcall __ntapi_tt_stat( stat->hfile = hfile; stat->dev_name_maxlen = (uint16_t)infolen - sizeof(*stat); + /* sigh */ + if (buffer_size >= 65536) + buffer_size = 65535; + /* system-unique device name */ if ((status = __ntapi->zw_query_information_file( hfile, diff --git a/src/fs/ntapi_tt_statfs.c b/src/fs/ntapi_tt_statfs.c index d131758..5d5de60 100644 --- a/src/fs/ntapi_tt_statfs.c +++ b/src/fs/ntapi_tt_statfs.c @@ -44,6 +44,10 @@ int32_t __stdcall __ntapi_tt_statfs( statfs->hfile = hfile; statfs->dev_name_maxlen = (uint16_t)infolen - sizeof(*statfs); + /* sigh */ + if (buffer_size >= 65536) + buffer_size = 65535; + /* maximum component length, file system type */ if ((status = __ntapi->zw_query_volume_information_file( hfile,