summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/skrewt.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/skrewt.c b/tools/skrewt.c
index da0ed64..8ae4db4 100644
--- a/tools/skrewt.c
+++ b/tools/skrewt.c
@@ -100,12 +100,15 @@ int main(int argc, char** argv){
int text_type(1);
int textlines(0);
int gotdate(0);
+ int msgsize(0);
+ int msgmax(1000000);
for (;;){
if (cin.eof()) break;
if (cin.bad()) return 1;
if (inheads) {
string header;
if (getline(cin, header).fail()) continue;
+ msgsize += header.length()+1;
for (;;) {
if (cin.eof()) break;
if (cin.bad()) return 1;
@@ -115,6 +118,11 @@ int main(int argc, char** argv){
if (ch != ' ' && ch != '\t') break;
string line;
if (getline(cin, line).fail()) continue;
+ msgsize += line.length()+1;
+ if (msgsize > msgmax) {
+ cerr << "skrewt rejection: bigger than " << msgmax << endl;
+ exit(1);
+ }
header += "\n" + line;
}
if (header.length() == 0) {
@@ -176,6 +184,11 @@ int main(int argc, char** argv){
} else {
string line;
if (!getline(cin, line).fail()) {
+ msgsize += line.length()+1;
+ if (msgsize > msgmax) {
+ cerr << "skrewt rejection: bigger than " << msgmax << endl;
+ exit(1);
+ }
if (line == "--" + boundary) {
inheads = 1;
} else {