I am trying to execute this code
Process process = new ProcessBuilder().command("mount").start();
process.waitFor();
to find out the sd card location and then afterwards checking if it is managed by vold and if the file system is vfat.
My question is if anyway this code can be comproprised and become a candidate for command injection in Android.
Couple points from my side.
Its not user input so there will be no command injection in that case. Can the whole Android OS environment be changed such that mount command can be ill used ?
cheers, Saurav
ok...Currently i am reading /proc/mounts replacing the mount command.
Is this is the good way to do.
References for this solution http://renzhi.ca/2012/02/03/how-to-list-all-sd-cards-on-android/ How can I get the list of mounted external storage of android device
code below
reader = new BufferedReader(new FileReader("/proc/mounts"));
String line;
while ((line = reader.readLine()) != null) {
// Output the line of output from the mount command
logger.debug(" {}", line);
if (line.startsWith("/dev/block/vold/")) {
Can anyone please if this is the correct way to do and is free of any security issues.
cheers, Saurav