summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@codelibre.net>2021-02-06 12:33:20 +0000
committerRoger Leigh <rleigh@codelibre.net>2021-02-06 14:00:40 +0000
commit2655fed3631aac836dede07ef67e499599343456 (patch)
tree106fda37bebb187eb51525011e6d11944b1be06a
parent9ae8cb5a8e08b1fbf3963c137addba354c625934 (diff)
downloadlibtiff-git-2655fed3631aac836dede07ef67e499599343456.tar.gz
custom_dir_EXIF_231: Correct use of strncpy
-rw-r--r--test/custom_dir_EXIF_231.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/custom_dir_EXIF_231.c b/test/custom_dir_EXIF_231.c
index a0d78fa1..0ed8ae65 100644
--- a/test/custom_dir_EXIF_231.c
+++ b/test/custom_dir_EXIF_231.c
@@ -1095,7 +1095,8 @@ write_test_tiff(TIFF *tif, const char *filenameRead)
break;
}
/* Save string from temporary buffer and compare with written string. */
- strncpy(auxCharArray, pAscii, sizeof(auxCharArray));
+ strncpy(auxCharArray, pAscii, sizeof(auxCharArray) - 1u);
+ auxCharArray[sizeof(auxCharArray) - 1u] = '\0';
if (tWriteCount > 0) auxLong = tWriteCount-1; else auxLong = (long)strlen(auxCharArray);
retCode2 = strncmp(auxCharArray, auxTextArrayW[i], auxLong);
if (retCode2 != 0) {