diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-12 17:06:50 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-12 17:06:50 +0200 |
| commit | ef087c3849cfbe58f4f77e09367d6fbf152e5498 (patch) | |
| tree | 50887156f53a784f5d8f9bdadc5e5ed727365fe6 /test | |
| parent | 37a48208d419a6c2797f5705ba37d7b362fcb8fe (diff) | |
| download | nissy-core-ef087c3849cfbe58f4f77e09367d6fbf152e5498.tar.gz nissy-core-ef087c3849cfbe58f4f77e09367d6fbf152e5498.zip | |
Make writemoves (and solver) safer by checking buffer size
Diffstat (limited to 'test')
| -rw-r--r-- | test/032_invertmoves/invertmoves_tests.c | 4 | ||||
| -rw-r--r-- | test/061_inverse_trans/inverse_trans_tests.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/test/032_invertmoves/invertmoves_tests.c b/test/032_invertmoves/invertmoves_tests.c index acb2adc..d5da323 100644 --- a/test/032_invertmoves/invertmoves_tests.c +++ b/test/032_invertmoves/invertmoves_tests.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #define MAXMOVES 20 | 3 | #define MAXMOVES 20 |
| 4 | 4 | ||
| 5 | int64_t readmoves(const char *, int, uint8_t *); | 5 | int64_t readmoves(const char *, int, uint8_t *); |
| 6 | void writemoves(uint8_t *, int, char *); | 6 | void writemoves(uint8_t *, int, uint64_t, char *); |
| 7 | void invertmoves(uint8_t *, uint8_t, uint8_t *); | 7 | void invertmoves(uint8_t *, uint8_t, uint8_t *); |
| 8 | 8 | ||
| 9 | void run(void) { | 9 | void run(void) { |
| @@ -15,7 +15,7 @@ void run(void) { | |||
| 15 | c = readmoves(movestr, MAXMOVES, moves); | 15 | c = readmoves(movestr, MAXMOVES, moves); |
| 16 | 16 | ||
| 17 | invertmoves(moves, c, ret); | 17 | invertmoves(moves, c, ret); |
| 18 | writemoves(ret, c, outstr); | 18 | writemoves(ret, c, STRLENMAX, outstr); |
| 19 | 19 | ||
| 20 | printf("%s\n", outstr); | 20 | printf("%s\n", outstr); |
| 21 | } | 21 | } |
diff --git a/test/061_inverse_trans/inverse_trans_tests.c b/test/061_inverse_trans/inverse_trans_tests.c index bbc1ac9..441fef8 100644 --- a/test/061_inverse_trans/inverse_trans_tests.c +++ b/test/061_inverse_trans/inverse_trans_tests.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | uint8_t readtrans(char *); | 3 | uint8_t readtrans(char [static NISSY_SIZE_TRANSFORMATION]); |
| 4 | uint8_t inverse_trans(uint8_t); | 4 | uint8_t inverse_trans(uint8_t); |
| 5 | cube_t applymoves(cube_t, char *); | 5 | cube_t applymoves(cube_t, char *); |
| 6 | cube_t applytrans(cube_t, char *); | 6 | cube_t applytrans(cube_t, char *); |
