itinance / itinance/react-native-fs

Coverity Issues - Resource leak and URI manipulation

Open
#1,189 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Hello,
We use coverity in our project and it shows few issues in the file - RNFSManager.java

1. Resource Leak - In the method - public void read(String filepath, int length, int position, Promise promise), inputstream is not closed and hence it leaks -
2. Resource Leak - In the method - public void readFile(String filepath, Promise promise), inputStream variable is not closed and hence it leaks when it goes out of scope
3. Resource Leak - In the method - public void hash(String filepath, String algorithm, Promise promise), inputStream variable is not closed and hence it leaks when it goes out of scope.
4. Filesystem path, filename, or URI manipulation (A user-controllable string is used as part or all of a filesystem path, filename, or URI (uniform resource identifier)) - In the method - public void stat(String filepath, Promise promise) -
`String originalFilepath = getOriginalFilepath(filepath, true);`
`originalFilePath` is resultant from RNFSManager.java, where it is result of cursor which may be errorprone.

Request to triage. Thanks

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.