diff -r 6fceb66e1ad7 -r 2fdc9cc89502 org/sonews/util/io/ArticleReader.java --- a/org/sonews/util/io/ArticleReader.java Fri Jun 26 16:48:50 2009 +0200 +++ b/org/sonews/util/io/ArticleReader.java Wed Jul 22 14:04:05 2009 +0200 @@ -26,6 +26,7 @@ import java.io.UnsupportedEncodingException; import java.net.Socket; import java.net.UnknownHostException; +import org.sonews.config.Config; import org.sonews.util.Log; /** @@ -72,6 +73,8 @@ public byte[] getArticleData() throws IOException, UnsupportedEncodingException { + long maxSize = Config.inst().get(Config.ARTICLE_MAXSIZE, 1024) * 1024L; + try { this.out.write(("ARTICLE " + this.messageID + "\r\n").getBytes("UTF-8")); @@ -90,6 +93,11 @@ } buf.write(10); + if(buf.size() > maxSize) + { + Log.msg("Skipping message that is too large: " + buf.size(), false); + return null; + } } return buf.toByteArray();