Reading non zero terminated ascii tags is broken
As part of fix Bug 2590 - CVE-2016-9297 ASCII tags read from the file are enforced to have terminating zero potentially overwriting meaningful data obtained.
Version
4.5.0
Steps to reproduce
Write ASCII tag using e.g. a call TIFFSetField(mHandle, TIFFTAG_PHOTOSHOP, (uint32_t)tiffTag.size(), tiffTag.c_str()); where tiffTag is std::string with some information.
Try to read that tag later: uint32_t tiffTagSize = 0; const char* tiffTagData = NULL; TIFFGetField(pTiff, TIFFTAG_RIP_PARAMETERS, &tiffTagSize, &tiffTagData); and discover that the original content is one byte truncated.
Platform
(Windows11, x64, Visual Studio 2022 (17.6))