Write a comment-only python file padded well past `bytes`. The file is never * parsed (the size cap rejects it before extraction), so its content only needs * to make it a discoverable .py source that exceeds the cap. */
| 36 | * parsed (the size cap rejects it before extraction), so its content only needs |
| 37 | * to make it a discoverable .py source that exceeds the cap. */ |
| 38 | static void ri_write_big(const char *dir, const char *name, size_t bytes) { |
| 39 | char path[700]; |
| 40 | snprintf(path, sizeof(path), "%s/%s", dir, name); |
| 41 | FILE *f = fopen(path, "wb"); |
| 42 | if (!f) { |
| 43 | return; |
| 44 | } |
| 45 | static const char line[] = "# oversized filler line padding this file past the size cap\n"; |
| 46 | size_t linelen = sizeof(line) - 1; |
| 47 | size_t written = 0; |
| 48 | while (written < bytes) { |
| 49 | fwrite(line, 1, linelen, f); |
| 50 | written += linelen; |
| 51 | } |
| 52 | fclose(f); |
| 53 | } |
| 54 | |
| 55 | /* Slurp a whole file into a heap buffer (NUL-terminated). NULL on error. */ |
| 56 | static char *ri_slurp(const char *path) { |
no outgoing calls
no test coverage detected