From ef087c3849cfbe58f4f77e09367d6fbf152e5498 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sat, 12 Oct 2024 17:06:50 +0200 Subject: Make writemoves (and solver) safer by checking buffer size --- test/032_invertmoves/invertmoves_tests.c | 4 ++-- test/061_inverse_trans/inverse_trans_tests.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test') 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 @@ #define MAXMOVES 20 int64_t readmoves(const char *, int, uint8_t *); -void writemoves(uint8_t *, int, char *); +void writemoves(uint8_t *, int, uint64_t, char *); void invertmoves(uint8_t *, uint8_t, uint8_t *); void run(void) { @@ -15,7 +15,7 @@ void run(void) { c = readmoves(movestr, MAXMOVES, moves); invertmoves(moves, c, ret); - writemoves(ret, c, outstr); + writemoves(ret, c, STRLENMAX, outstr); printf("%s\n", outstr); } 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 @@ #include "../test.h" -uint8_t readtrans(char *); +uint8_t readtrans(char [static NISSY_SIZE_TRANSFORMATION]); uint8_t inverse_trans(uint8_t); cube_t applymoves(cube_t, char *); cube_t applytrans(cube_t, char *); -- cgit v1.3