Skip to content

Instantly share code, notes, and snippets.

@n8fr8
Created January 31, 2022 16:24
Show Gist options
  • Save n8fr8/c71ffae633939342011470259fd1ab56 to your computer and use it in GitHub Desktop.
Save n8fr8/c71ffae633939342011470259fd1ab56 to your computer and use it in GitHub Desktop.
JNIEXPORT jint JNICALL Java_org_torproject_android_service_vpn_Tun2Socks_processDnsPacket(
jclass cls,
JNIEnv* env,
jbyteArray packet,
jint dataLength)
{
jboolean isCopy;
jbyte* dataPtr = (*env)->GetByteArrayElements(env, packet, &isCopy);
process_device_dns_packet ((uint8_t *)dataPtr, dataLength);
return 1;
}
@n8fr8
Copy link
Author

n8fr8 commented Jan 31, 2022

crashes when called from Java passing UDP packet via byte[] array

if I comment out lines 8,9,10 does not crash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment