From 1266c3c73ec332071e1d72017338bb06dccef82a Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 27 Mar 2012 20:41:43 +0200 Subject: [PATCH] Don't allow invalid values for header/footer insertion point --- src/com/fsck/k9/activity/InsertableHtmlContent.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/com/fsck/k9/activity/InsertableHtmlContent.java b/src/com/fsck/k9/activity/InsertableHtmlContent.java index ab413e19d..851f0ca9a 100644 --- a/src/com/fsck/k9/activity/InsertableHtmlContent.java +++ b/src/com/fsck/k9/activity/InsertableHtmlContent.java @@ -32,11 +32,20 @@ class InsertableHtmlContent implements Serializable { } public void setHeaderInsertionPoint(int headerInsertionPoint) { - this.headerInsertionPoint = headerInsertionPoint; + if (headerInsertionPoint < 0 || headerInsertionPoint > quotedContent.length()) { + this.headerInsertionPoint = 0; + } else { + this.headerInsertionPoint = headerInsertionPoint; + } } public void setFooterInsertionPoint(int footerInsertionPoint) { - this.footerInsertionPoint = footerInsertionPoint; + int len = quotedContent.length(); + if (footerInsertionPoint < 0 || footerInsertionPoint > len) { + this.footerInsertionPoint = len; + } else { + this.footerInsertionPoint = footerInsertionPoint; + } } /**