1.1 --- a/org/sonews/util/io/ArticleReader.java Wed Jul 01 10:48:22 2009 +0200
1.2 +++ b/org/sonews/util/io/ArticleReader.java Wed Jul 22 14:04:05 2009 +0200
1.3 @@ -26,6 +26,7 @@
1.4 import java.io.UnsupportedEncodingException;
1.5 import java.net.Socket;
1.6 import java.net.UnknownHostException;
1.7 +import org.sonews.config.Config;
1.8 import org.sonews.util.Log;
1.9
1.10 /**
1.11 @@ -72,6 +73,8 @@
1.12 public byte[] getArticleData()
1.13 throws IOException, UnsupportedEncodingException
1.14 {
1.15 + long maxSize = Config.inst().get(Config.ARTICLE_MAXSIZE, 1024) * 1024L;
1.16 +
1.17 try
1.18 {
1.19 this.out.write(("ARTICLE " + this.messageID + "\r\n").getBytes("UTF-8"));
1.20 @@ -90,6 +93,11 @@
1.21 }
1.22
1.23 buf.write(10);
1.24 + if(buf.size() > maxSize)
1.25 + {
1.26 + Log.msg("Skipping message that is too large: " + buf.size(), false);
1.27 + return null;
1.28 + }
1.29 }
1.30
1.31 return buf.toByteArray();