PKGBUILDs/core/grep/14-mem-exhausted.patch

16 lines
486 B
Diff
Raw Normal View History

--- grep-2.5.1a/src/grep.c.mem-exhausted 2006-11-22 14:49:35.000000000 +0000
+++ grep-2.5.1a/src/grep.c 2006-11-22 14:53:12.000000000 +0000
@@ -299,6 +299,12 @@
int cc = 1;
char *readbuf;
size_t readsize;
+ const size_t max_save = 200 * 1024 * 1024;
+
+ /* Limit the amount of saved data to 200Mb so we don't fail on
+ * large files. */
+ if (save > max_save)
+ save = max_save;
/* Offset from start of buffer to start of old stuff
that we want to save. */