ui/app: (android) fix length of C string copy

The data dir string is returned to Go as a byte array of the UTF-8
encoded string, but it is not NUL terminated.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-08 16:15:45 +02:00
parent 5f15f4c769
commit f7ea448256
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -106,7 +106,8 @@ JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
if (dir == NULL) {
return -1;
}
setDataDir((char *)dir);
jint n = (*env)->GetArrayLength(env, dirArr);
setDataDir((char *)dir, n);
(*env)->ReleaseByteArrayElements(env, dirArr, dir, JNI_ABORT);
return JNI_VERSION_1_6;