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. */
| 48 | * parsed (the size cap rejects it before extraction), so its content only needs |
| 49 | * to make it a discoverable .py source that exceeds the cap. */ |
| 50 | static void ri_write_big(const char *dir, const char *name, size_t bytes) { |
| 51 | char path[700]; |
| 52 | snprintf(path, sizeof(path), "%s/%s", dir, name); |
| 53 | FILE *f = fopen(path, "wb"); |
| 54 | if (!f) { |
| 55 | return; |
| 56 | } |
| 57 | static const char line[] = "# oversized filler line padding this file past the size cap\n"; |
| 58 | size_t linelen = sizeof(line) - 1; |
| 59 | size_t written = 0; |
| 60 | while (written < bytes) { |
| 61 | fwrite(line, 1, linelen, f); |
| 62 | written += linelen; |
| 63 | } |
| 64 | fclose(f); |
| 65 | } |
| 66 | |
| 67 | /* Slurp a whole file into a heap buffer (NUL-terminated). NULL on error. */ |
| 68 | static char *ri_slurp(const char *path) { |
no outgoing calls
no test coverage detected