From e9b18baaf93b3e8f11538614f0cb67d4ece4b23d Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 29 Jun 2016 16:56:53 -0400 Subject: __ntapi_pty_open: refactor, explicit string comparison. --- src/pty/ntapi_pty_fd.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/pty') 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 *) -- cgit v1.2.3