From 51deb6711a845e8797f3818d4d453bb29ac1a951 Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Mon, 18 Dec 2023 20:07:55 +0000 Subject: Fix strncpy buffer lengths --- test/GNU/table-from.c | 2 +- test/GNU/table-to.c | 2 +- test/iconv.c | 2 +- test/nullable.c | 2 +- test/translit.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/GNU/table-from.c b/test/GNU/table-from.c index 56a0dab..92300d6 100644 --- a/test/GNU/table-from.c +++ b/test/GNU/table-from.c @@ -126,7 +126,7 @@ int main (int argc, char* argv[]) exit(1); } - strncpy(aliases, ucpath, sizeof(aliases)); + strncpy(aliases, ucpath, sizeof(aliases) - 1); alen = strlen(ucpath); #ifndef __riscos__ if (aliases[alen - 1] != '/') { diff --git a/test/GNU/table-to.c b/test/GNU/table-to.c index 62c30a8..3246428 100644 --- a/test/GNU/table-to.c +++ b/test/GNU/table-to.c @@ -59,7 +59,7 @@ int main (int argc, char* argv[]) exit(1); } - strncpy(aliases, ucpath, sizeof(aliases)); + strncpy(aliases, ucpath, sizeof(aliases) - 1); alen = strlen(ucpath); #ifndef __riscos__ if (aliases[alen - 1] != '/') { diff --git a/test/iconv.c b/test/iconv.c index cd0bfa3..f257782 100644 --- a/test/iconv.c +++ b/test/iconv.c @@ -28,7 +28,7 @@ int main(int argc, char **argv) assert(ucpath != NULL); - strncpy(aliases, ucpath, sizeof(aliases)); + strncpy(aliases, ucpath, sizeof(aliases) - 1); alen = strlen(aliases); #ifndef __riscos__ if (aliases[alen - 1] != '/') { diff --git a/test/nullable.c b/test/nullable.c index c9523f5..2052702 100644 --- a/test/nullable.c +++ b/test/nullable.c @@ -77,7 +77,7 @@ int main(int argc, char **argv) assert(ucpath != NULL); - strncpy(aliases, ucpath, sizeof(aliases)); + strncpy(aliases, ucpath, sizeof(aliases) - 1); alen = strlen(aliases); #ifndef __riscos__ if (aliases[alen - 1] != '/') { diff --git a/test/translit.c b/test/translit.c index 240f5e2..d8252d2 100644 --- a/test/translit.c +++ b/test/translit.c @@ -122,7 +122,7 @@ int main(int argc, char **argv) assert(ucpath != NULL); - strncpy(aliases, ucpath, sizeof(aliases)); + strncpy(aliases, ucpath, sizeof(aliases) - 1); alen = strlen(aliases); #ifndef __riscos__ if (aliases[alen - 1] != '/') { -- cgit v1.2.3