On Fri, 6 Nov 2026 08:57:17 GMT, Matthias Baesken <[email protected]> wrote:

>> We potentially leak a handle in case of failing malloc.
>> 
>> Additionally, GetFinalPathNameByHandleW can fail and return 0.  Then we 
>> should free a newly allocated buffer.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Matthias Baesken has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Remove unneeded variable newFinalPath

btw. the UNC prefix strip - operation seems to be pretty similar (almost the 
same) here to what we have in canonicalize_md.c
https://github.com/openjdk/jdk/blob/7e94da336f62873842bbf71706b171c8c965a184/src/java.base/windows/native/libjava/WinNTFileSystem_md.c#L105

should we have a common function for it to avoid code duplication?

One issue with the UNC-strip, we access elements 0,1,2,3  for the if-check to 
find out if it is a UNC path. and later access even elements 4,5,6 . But is it 
even clear that we have so many elements in the array ? Shouldn't we better 
check this to avoid OOB access in some special/malformed input scenarios ?
Or is this not possible ( then a comment would be good).

-------------

PR Comment: https://git.openjdk.org/jdk/pull/33752#issuecomment-6681327841

Reply via email to