Commit 1391c86c authored by Daniel Lenski's avatar Daniel Lenski

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
parent 1dc202e4
......@@ -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);
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment