From a450b52f90f07747e8ce489b8ae269d81b48a74b Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Thu, 2 Jul 2009 06:57:15 +0000 Subject: Limit keyfile imports to some sane size git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@349 df292f66-193f-0410-a5fc-6d59da041ff2 --- src/org/connectbot/PubkeyListActivity.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/org/connectbot/PubkeyListActivity.java b/src/org/connectbot/PubkeyListActivity.java index 452e3b4..2393c93 100644 --- a/src/org/connectbot/PubkeyListActivity.java +++ b/src/org/connectbot/PubkeyListActivity.java @@ -80,6 +80,8 @@ import com.trilead.ssh2.crypto.PEMStructure; public class PubkeyListActivity extends ListActivity implements EventListener { public final static String TAG = "ConnectBot.PubkeyListActivity"; + private static final int MAX_KEYFILE_SIZE = 8192; + protected PubkeyDatabase pubkeydb; private List pubkeys; @@ -240,6 +242,13 @@ public class PubkeyListActivity extends ListActivity implements EventListener { pubkey.setNickname(name); File actual = new File(sdcard, name); + if (actual.length() > MAX_KEYFILE_SIZE) { + Toast.makeText(PubkeyListActivity.this, + R.string.pubkey_import_parse_problem, + Toast.LENGTH_LONG).show(); + return; + } + // parse the actual key once to check if its encrypted // then save original file contents into our database try { -- cgit v1.2.3