gaffe23 / linux-inject

Tool for injecting a shared object into a Linux process
Other
1.1k stars 246 forks source link

use ptrdiff_t not size_t #4

Closed Eriner closed 8 years ago

Eriner commented 8 years ago

This sets the buffer size (differentials) type correctly.

gaffe23 commented 8 years ago

I believe size_t is actually the most appropriate choice here. ptrdiff_t is a signed type, whereas size_t is unsigned. Even though injectSharedLibrary_size is calculated by subtracting two pointer values, it ultimately represents a size value that should always be positive, since it gets passed as the size argument to malloc later on.

Eriner commented 8 years ago

Yes, seeing as it's always calculating a positive offset, you are correct. I'll close this PR.