File: filesize.patch

package info (click to toggle)
elvis-tiny 1.4-25
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,104 kB
  • sloc: ansic: 13,810; sh: 25; makefile: 13
file content (32 lines) | stat: -rw-r--r-- 767 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff '--exclude=debian' -ruN x/elvis-tiny-1.4.orig/cmd2.c elvis-tiny-1.4/cmd2.c
--- a/cmd2.c
+++ b/cmd2.c
@@ -591,6 +591,12 @@ void cmd_read(frommark, tomark, cmd, ban
 		msg("\"%s\" is not a regular file", extra);
 		return;
 	}
+	if (statb.st_size > 500000)
+	{
+		msg("\"%s\" is too large (>500000 bytes)", extra);
+		close(fd);
+		return;
+	}
 #endif /* not CRUNCH */
 
 	/* get blocks from the file, and add them */
--- a/tmp.c
+++ b/tmp.c
@@ -132,6 +132,13 @@ int tmpstart(filename)
 				msg("\"%s\" is not a regular file", origname);
 				return tmpstart("");
 			}
+			/* Can't edit files > 500.000 bytes */
+			if (statb.st_size > 500000)
+			{
+				msg("\"%s\" is too big (>500000 bytes)",
+					origname);
+				return tmpstart("");
+			}
 		}
 		else
 		{