src/windows/native/java/io/WinNTFileSystem_md.c

Print this page

        

@@ -539,10 +539,14 @@
 {
     HANDLE h = NULL;
     WCHAR *pathbuf = pathToNTPath(env, path, JNI_FALSE);
     if (pathbuf == NULL)
         return JNI_FALSE;
+    if (isReservedDeviceNameW(pathbuf)) {
+        free(pathbuf);
+        return JNI_FALSE;
+    }
     h = CreateFileW(
         pathbuf,                              /* Wide char path name */
         GENERIC_READ | GENERIC_WRITE,         /* Read and write permission */
         FILE_SHARE_READ | FILE_SHARE_WRITE,   /* File sharing flags */
         NULL,                                 /* Security attributes */