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

add win32 DLL ordinal value function support #689

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions native/dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ w32_short_name(JNIEnv* env, jstring str) {

static HANDLE
w32_find_entry(JNIEnv* env, HANDLE handle, const char* funname) {
if (funcname[0] == '#') funname = (const char *)atoi(funname + 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for NULL, too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's already checked in function 'Java_com_sun_jna_Native_findSymbol'

Copy link
Member

@dblock dblock Aug 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until someone removes it or calls this from another scope. The repercussions of security vulnerabilities caused by this in case that happens are pretty major, it costs nothing at runtime and is basic defensive programming, just my 0.02c.

void* func = NULL;
if (handle != GetModuleHandle(NULL)) {
func = GetProcAddress(handle, funname);
Expand Down