Skip to content
Snippets Groups Projects
Commit 946e7491 authored by pm_cz's avatar pm_cz
Browse files

Suggested changes preventing code injection

parent 94da50db
No related branches found
No related tags found
No related merge requests found
......@@ -126,6 +126,10 @@ public class ScpClient implements Closeable {
{
AckowledgementChecker ack = new AckowledgementChecker();
// exec 'scp -f rfile' remotely
lfile=lfile.replace("'", "'\"'\"'");
lfile="'"+lfile+"'";
String command = "scp -f " + lfile;
Channel channel = getConnectedSession().openChannel("exec");
......@@ -265,6 +269,10 @@ public class ScpClient implements Closeable {
public long size(String lfile) throws JSchException, IOException {
AckowledgementChecker ack = new AckowledgementChecker();
// exec 'scp -f rfile' remotely
lfile=lfile.replace("'", "'\"'\"'");
lfile="'"+lfile+"'";
String command = "scp -f " + lfile;
Channel channel = getConnectedSession().openChannel("exec");
......@@ -410,6 +418,9 @@ public class ScpClient implements Closeable {
AckowledgementChecker ack = new AckowledgementChecker();
boolean ptimestamp = false;
// exec 'scp -t rfile' remotely
fileName=fileName.replace("'", "'\"'\"'");
String command = "scp " + (ptimestamp ? "-p" : "") + " -t '" + fileName + "'";
Channel channel = getConnectedSession().openChannel("exec");
((ChannelExec) channel).setCommand(command);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment