2 By John Walker written ages ago.
6 Beat denial of service floggers to death by persuading
7 them to download a HOW_BIG pseudo GIF file which is actually
8 a holey file occupying trivial space on our server.
12 Output: a file named gigaslam.gif that contains something like
13 16K bytes (i.e. 2-8K blocks), but appears to be 1GB in
14 length because the second block is written at a 1GB
17 Be careful what you do with this file as not all programs know
18 how to deal with sparse files.
22 #define HOW_BIG 1000000000ll
28 #ifndef _FILE_OFFSET_BITS
29 #define _FILE_OFFSET_BITS 64
37 int main(int argc, char *const *argv)
39 FILE *fp = fopen("gigaslam.gif", "w");
40 char header[] = "<html>\n<table>\n<tr><td>\n";
41 char trailer[] = "</html>\n";
42 off_t howBig = HOW_BIG;
44 fwrite(header, sizeof header, 1, fp);
45 fseeko(fp, howBig - strlen(trailer), 0);
46 fwrite(trailer, strlen(trailer), 1, fp);