Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
6.1k views
in Java FTP by (300 points)
Hi
I'm getting Java Heap Space when trying to put server's private(!) key as public one
The test came out accidentally when one of the testers took out the private key instead of public.
I know, we are not supposed to use private keys, but still, some validation exception will be nicer than JHS :)

            SSHFTPClient sftpClient = new SSHFTPClient();
            sftpClient.setRemoteHost(host);
            sftpClient.setAuthentication(userName, ePassword);
            String pKey = args[0] + " " + args[1];
            
               ByteArrayInputStream str = new ByteArrayInputStream(pKey.getBytes());
                try
                {
                    System.out.println("Validating sever public key.");
                    sftpClient.getValidator().addKnownHost(host, str);
                }
                catch(Exception e)
                {
                    System.out.println(e.getMessage());
                }


Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at com.enterprisedt.net.j2ssh.io.ByteArrayReader.readString(Unknown Source)
at com.enterprisedt.net.j2ssh.transport.publickey.SshPublicKeyFile.toPublicKey(Unknown Source)
at com.enterprisedt.net.ftp.ssh.SSHFTPValidator.addKnownHost(Unknown Source)


BTW, same behavior for 2.0.1 and 3.0.2 edtFTPj/PRO versions

3 Answers

0 votes
by (162k points)
Thanks, we'll take a look. Must have an invalid string length and be trying to read a very long string.
0 votes
by (300 points)
Ok
Please, tell me what is the problem - i need to modify the the bug so QA will be able to verify it, and when it will be fixed.
0 votes
by (162k points)
We've made a mod so it throws an IOException if the length of the public key is unreasonably long. Email us at support at enterprisedt dot com to get a jar to try out.

Categories

...