Skip to content

Commit bde6d16

Browse files
committed
🔒 Fix: use ProcessBuilder for logcat shell execution
Migrates `Runtime.getRuntime().exec` to `ProcessBuilder` with array args in AboutScreen to avoid relying on unsafe string tokenization for command execution.
1 parent 82758c7 commit bde6d16

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

app/src/main/java/helium314/keyboard/settings/screens/AboutScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fun createAboutSettings(context: Context) = listOf(
169169
scope.launch(Dispatchers.IO) {
170170
ctx.getActivity()?.contentResolver?.openOutputStream(uri)?.use { os ->
171171
os.writer().use { writer ->
172-
val logcat = Runtime.getRuntime().exec("logcat -d -b all *:W").inputStream.use { it.reader().readText() }
172+
val logcat = ProcessBuilder("logcat", "-d", "-b", "all", "*:W").start().inputStream.use { it.reader().readText() }
173173
val internal = Log.getLog().joinToString("\n")
174174
writer.write(logcat + "\n\n" + internal)
175175
}

0 commit comments

Comments
 (0)