Skip to content

Commit

Permalink
fix: jni su to_uid
Browse files Browse the repository at this point in the history
  • Loading branch information
bmax committed Jan 17, 2024
1 parent 0cf11f4 commit f89cc0e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions user/android/apjni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ extern "C" JNIEXPORT jlong JNICALL Java_me_bmax_apatch_Natives_nativeSu(JNIEnv *
if (scontext) sctx = env->GetStringUTFChars(scontext, NULL);
struct su_profile profile = { 0 };
profile.uid = getuid();
profile.to_uid = (pid_t)to_uid;
if (sctx) {
strncpy(profile.scontext, sctx, sizeof(profile.scontext) - 1);
}
Expand All @@ -86,6 +87,8 @@ extern "C" JNIEXPORT jlong JNICALL Java_me_bmax_apatch_Natives_nativeThreadSu(JN
const char *sctx = 0;
if (scontext) sctx = env->GetStringUTFChars(scontext, NULL);
struct su_profile profile = { 0 };
profile.uid = getuid();
profile.to_uid = (pid_t)to_uid;
if (sctx) {
strncpy(profile.scontext, sctx, sizeof(profile.scontext) - 1);
}
Expand Down

0 comments on commit f89cc0e

Please sign in to comment.