isnull / xattrj Goto Github PK
View Code? Open in Web Editor NEWNative xattr wrapper (JNI) for java
Native xattr wrapper (JNI) for java
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).
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.
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
Hi,
great work. To make it complete, support for listing attribute names and removing attributes would be great.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.