Skip to content

Commit f89cc0e

Browse files
author
bmax
committed
fix: jni su to_uid
1 parent 0cf11f4 commit f89cc0e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: user/android/apjni.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ extern "C" JNIEXPORT jlong JNICALL Java_me_bmax_apatch_Natives_nativeSu(JNIEnv *
7070
if (scontext) sctx = env->GetStringUTFChars(scontext, NULL);
7171
struct su_profile profile = { 0 };
7272
profile.uid = getuid();
73+
profile.to_uid = (pid_t)to_uid;
7374
if (sctx) {
7475
strncpy(profile.scontext, sctx, sizeof(profile.scontext) - 1);
7576
}
@@ -86,6 +87,8 @@ extern "C" JNIEXPORT jlong JNICALL Java_me_bmax_apatch_Natives_nativeThreadSu(JN
8687
const char *sctx = 0;
8788
if (scontext) sctx = env->GetStringUTFChars(scontext, NULL);
8889
struct su_profile profile = { 0 };
90+
profile.uid = getuid();
91+
profile.to_uid = (pid_t)to_uid;
8992
if (sctx) {
9093
strncpy(profile.scontext, sctx, sizeof(profile.scontext) - 1);
9194
}

0 commit comments

Comments
 (0)