Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix segfault in Java library test application
calling the Java method setCSDWrapper(String wrapper, String TMPDIR, String
PATH) with null TMPDIR and PATH would cause a segfault because
openconnect_set_csd_wrapper(vpninfo, name, value) requires a non-NULL value
  • Loading branch information
dlenski committed Aug 5, 2018
1 parent 1dc202e commit 1391c86
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jni.c
Expand Up @@ -879,8 +879,8 @@ JNIEXPORT void JNICALL Java_org_infradead_libopenconnect_LibOpenConnect_setCSDWr
!get_cstring(ctx->jenv, jarg2, &arg2)) {
openconnect_setup_csd(ctx->vpninfo, getuid(), 1, arg0);

openconnect_set_csd_environ(ctx->vpninfo, "TMPDIR", arg1);
openconnect_set_csd_environ(ctx->vpninfo, "PATH", arg2);
if (arg1) openconnect_set_csd_environ(ctx->vpninfo, "TMPDIR", arg1);
if (arg2) openconnect_set_csd_environ(ctx->vpninfo, "PATH", arg2);
}

release_cstring(ctx->jenv, jarg0, arg0);
Expand Down Expand Up @@ -1405,7 +1405,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_infradead_libopenconnect_LibOpenConnect_
{
jmethodID mid;
jobjectArray result;
struct libctx ctx = { .jenv = jenv, .jobj = NULL, .async_lock = NULL, vpninfo = -1, loglevel = -1 };
struct libctx ctx = { .jenv = jenv, .jobj = NULL, .async_lock = NULL, .vpninfo = NULL, .cmd_fd = -1, .loglevel = -1 };

/* call C library */
struct oc_vpn_proto *protos;
Expand Down

0 comments on commit 1391c86

Please sign in to comment.