client9 / libinjection

SQL / SQLI tokenizer parser analyzer
Other
1k stars 274 forks source link

Ruby Wrapping #86

Closed bararchy closed 9 years ago

bararchy commented 9 years ago

Hi,

I'm working on wrapping your great lib using ruby, the project is here --> https://github.com/bararchy/ruby-libinjection

I'm having some issues with the lib calling memfree from within, maybe you can give me a tip in the right direction ?

https://github.com/bararchy/ruby-libinjection/issues/1

Thanks

client9 commented 9 years ago

Hi there,

So sorry for the delay

re:

sfilter = LibC::malloc(1024)

This will work but its kinda scary. Im not familiar with ruby or ruby's FFI, but you want to do something like LibC:malloc( sizeof(sfilter)). I bet if you google hard you can a way of getting the "size of a c struct" or look for "sizeof" in FFI. Then it will be "proper".

good luck!

n

bararchy commented 9 years ago

@client9 , Thanks for the tip, sadly the only option was to create an external c program and read the size of struct, I kept using malloc(1024) as this is safely above the needed space.

Also binded to Crystal -- https://github.com/bararchy/crystal-libinjection :)