1
0
mirror of https://github.com/fumiama/base16384.git synced 2026-06-08 20:20:26 +08:00

fix(test): buffer overflow & adapt to windows

This commit is contained in:
源文雨
2024-04-05 16:05:30 +08:00
parent 29e4019ed1
commit b9e02241bd
3 changed files with 11 additions and 11 deletions

View File

@@ -44,12 +44,12 @@ char decbuf[BASE16384_DECBUFSZ];
char tstbuf[BASE16384_ENCBUFSZ];
#define init_input_file() \
for(i = 0; i < TEST_SIZE; i += sizeof(int)) { \
for(i = 0; i < BASE16384_ENCBUFSZ; i += sizeof(int)) { \
*(int*)(&encbuf[i]) = rand(); \
} \
fp = fopen(TEST_INPUT_FILENAME, "wb"); \
ok(!fp, "fopen"); \
ok(fwrite(encbuf, TEST_SIZE, 1, fp) != 1, "fwrite"); \
ok(fwrite(encbuf, BASE16384_ENCBUFSZ, 1, fp) != 1, "fwrite"); \
ok(fclose(fp), "fclose"); \
fputs("input file created.\n", stderr);