Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib.pcap.lua: replace ffi.cast() from a local string with ffi.copy() #244

Merged
merged 1 commit into from
Aug 25, 2014

Conversation

javierguerragiraldez
Copy link
Contributor

readc() reads a local string and casts to a pointer of a given type. The string goes out of scope and can be collected, making the pointer invalid. Replacing the cast with a copy makes it safer and allows the code generated by packet_filter to be JITted.

@javierguerragiraldez javierguerragiraldez changed the title lib.pcap.lua: copies read string into struct instead of hoping it will stay long enoug... lib.pcap.lua: replace ffi.cast() from a local string with ffi.copy() Aug 25, 2014
lukego added a commit that referenced this pull request Aug 25, 2014
lib.pcap.lua: replace ffi.cast() from a local string with ffi.copy()
@lukego lukego merged commit 8d9aa93 into snabbco:master Aug 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants