Giter Site home page Giter Site logo

xattrj's People

Contributors

isnull avatar riccardocossu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

xattrj's Issues

Probably a memory leak

I had a look to the code. I think you have to free all you reserve with malloc (also the second buffer you create to build a nul terminated string).

Code review - some potetial issues

Hi,

I'm really impressed how fast you reacted (for both, bug+feature request).
I'm just doing a full code review (for me for learning how things work and for your lib because I plan to use it in an environment where potentially then thousends of files or folders are marked using xattrs) and tell you, what I found:

You should always call ReleaseStringUTFChars if you called GetStringUTFChars before. See http://stackoverflow.com/questions/5859673/should-you-call-releasestringutfchars-if-getstringutfchars-returned-a-copy

In Java_org_securityvision_xattrj_Xattrj_listAttributes the buffer is always released at the end but might not get initialized (if (bufferLength > 0) ). No idea what will happen then.

That's all I see with my limited c++ knowledge. Good solution to split the null terminated string list on the native side - I tried it today but failed to pass the wohle buffer to java to split it there.

Regards,
Michael.

free null pointner

Hi, I found a little bug.

In the C++ code for listAttributes you do free(buffer) but buffer may not have been allocated if there are no xattr, so it'll crash.

This quick fix works for me:
if (bufferLength > 0) free(buffer);

cheers, reinhard

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.