diff options
author | Kenny Root <kenny@the-b.org> | 2009-07-02 06:57:15 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2009-07-02 06:57:15 +0000 |
commit | a450b52f90f07747e8ce489b8ae269d81b48a74b (patch) | |
tree | 2fda7a233ce51ae6a347de2f541e7c9bb637fb5c /src | |
parent | 9759a0c23ad865f6815b9af01a611ca38984f865 (diff) | |
download | connectbot-a450b52f90f07747e8ce489b8ae269d81b48a74b.tar.gz connectbot-a450b52f90f07747e8ce489b8ae269d81b48a74b.tar.bz2 connectbot-a450b52f90f07747e8ce489b8ae269d81b48a74b.zip |
Limit keyfile imports to some sane size
git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@349 df292f66-193f-0410-a5fc-6d59da041ff2
Diffstat (limited to 'src')
-rw-r--r-- | src/org/connectbot/PubkeyListActivity.java | 9 |
1 files changed, 9 insertions, 0 deletions
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<PubkeyBean> 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 { |