diff options
author | midipix <writeonce@midipix.org> | 2016-06-29 16:56:53 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-06-29 19:16:51 -0400 |
commit | e9b18baaf93b3e8f11538614f0cb67d4ece4b23d (patch) | |
tree | 06c168f61b9135125d9d682b3a9440f0c52c7c39 /src/pty | |
parent | 90028919e4ca20cc6ff04fc2d1114c928d6f0260 (diff) | |
download | ntapi-e9b18baaf93b3e8f11538614f0cb67d4ece4b23d.tar.bz2 ntapi-e9b18baaf93b3e8f11538614f0cb67d4ece4b23d.tar.xz |
__ntapi_pty_open: refactor, explicit string comparison.
Diffstat (limited to 'src/pty')
-rw-r--r-- | src/pty/ntapi_pty_fd.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/pty/ntapi_pty_fd.c b/src/pty/ntapi_pty_fd.c index ea62874..8e6110d 100644 --- a/src/pty/ntapi_pty_fd.c +++ b/src/pty/ntapi_pty_fd.c @@ -177,23 +177,28 @@ int32_t __stdcall __ntapi_pty_open( uint32_t open_options) { int32_t status; - uint32_t hash; nt_guid guid; nt_uuid_str_utf16 * guid_str; nt_pty * ctx; + wchar16_t * wch; + /* validate */ if (!obj_attr || !obj_attr->obj_name || !obj_attr->obj_name->buffer) return NT_STATUS_INVALID_PARAMETER; if (obj_attr->obj_name->strlen != __DEVICE_PATH_PREFIX_LEN + sizeof(nt_guid_str_utf16)) return NT_STATUS_OBJECT_PATH_INVALID; - hash = __ntapi->tt_buffer_crc32( - 0, - obj_attr->obj_name->buffer, - __DEVICE_PATH_PREFIX_LEN); + wch = obj_attr->obj_name->buffer; - if (hash != __DEVICE_PATH_PREFIX_HASH) + if ((wch[0] != '\\') + || (wch[1] != 'D') + || (wch[2] != 'e') + || (wch[3] != 'v') + || (wch[4] != 'i') + || (wch[5] != 'c') + || (wch[6] != 'e') + || (wch[7] != '\\')) return NT_STATUS_OBJECT_PATH_INVALID; guid_str = (nt_uuid_str_utf16 *) |