summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-06-11 23:51:36 +0000
committermidipix <writeonce@midipix.org>2019-06-11 23:53:43 +0000
commit7bb8ac5bd6ed78105d214554713ba1e46e5ddd23 (patch)
tree5b60237c77d38e91df21511a5aa015c387ab594a
parent1039602ffac9d4585ceb739545c2c3a369100df6 (diff)
downloadntapi-7bb8ac5bd6ed78105d214554713ba1e46e5ddd23.tar.bz2
ntapi-7bb8ac5bd6ed78105d214554713ba1e46e5ddd23.tar.xz
__ntapi_tt_{i}stat{fs}(): top-level UNC shares might not have a trailing slash.
-rw-r--r--src/fs/ntapi_tt_istat.c5
-rw-r--r--src/fs/ntapi_tt_stat.c5
-rw-r--r--src/fs/ntapi_tt_statfs.c5
3 files changed, 12 insertions, 3 deletions
diff --git a/src/fs/ntapi_tt_istat.c b/src/fs/ntapi_tt_istat.c
index 51f1d43..18840fb 100644
--- a/src/fs/ntapi_tt_istat.c
+++ b/src/fs/ntapi_tt_istat.c
@@ -25,6 +25,7 @@ int32_t __stdcall __ntapi_tt_istat(
nt_unicode_string * sdev;
wchar16_t * wch;
wchar16_t * wch_mark;
+ wchar16_t * wch_cap;
uint32_t hash;
uint32_t written;
@@ -108,7 +109,9 @@ int32_t __stdcall __ntapi_tt_istat(
hash = __DEVICE_PATH_PREFIX_HASH;
}
- for (; *wch!='\\'; )
+ wch_cap = sdev->buffer + (sdev->strlen / sizeof(wchar16_t));
+
+ for (; wch<wch_cap && *wch!='\\'; )
wch++;
istat->obj_name_strlen = sdev->strlen;
diff --git a/src/fs/ntapi_tt_stat.c b/src/fs/ntapi_tt_stat.c
index 088adf6..e262296 100644
--- a/src/fs/ntapi_tt_stat.c
+++ b/src/fs/ntapi_tt_stat.c
@@ -25,6 +25,7 @@ int32_t __stdcall __ntapi_tt_stat(
nt_fai * fai;
wchar16_t * wch;
wchar16_t * wch_mark;
+ wchar16_t * wch_cap;
uint32_t hash;
uint32_t written;
@@ -116,7 +117,9 @@ int32_t __stdcall __ntapi_tt_stat(
hash = __DEVICE_PATH_PREFIX_HASH;
}
- for (; *wch!='\\'; )
+ wch_cap = sdev->buffer + (sdev->strlen / sizeof(wchar16_t));
+
+ for (; wch<wch_cap && *wch!='\\'; )
wch++;
stat->obj_name_strlen = sdev->strlen;
diff --git a/src/fs/ntapi_tt_statfs.c b/src/fs/ntapi_tt_statfs.c
index 0638a54..d740759 100644
--- a/src/fs/ntapi_tt_statfs.c
+++ b/src/fs/ntapi_tt_statfs.c
@@ -23,6 +23,7 @@ int32_t __stdcall __ntapi_tt_statfs(
nt_unicode_string * sdev;
wchar16_t * wch;
wchar16_t * wch_mark;
+ wchar16_t * wch_cap;
uint32_t offset;
uint32_t hash;
void * mnt_points_buffer;
@@ -157,7 +158,9 @@ int32_t __stdcall __ntapi_tt_statfs(
hash = __DEVICE_PATH_PREFIX_HASH;
}
- for (; *wch!='\\'; )
+ wch_cap = sdev->buffer + (sdev->strlen / sizeof(wchar16_t));
+
+ for (; wch<wch_cap && *wch!='\\'; )
wch++;
statfs->obj_name_strlen = sdev->strlen;