From 0cf67888e32e36b45828dd467920684c93f2b22d Mon Sep 17 00:00:00 2001 From: Timothy Lyanguzov Date: Tue, 25 Jan 2022 04:27:28 +0000 Subject: [PATCH] Apply 4 suggestion(s) to 1 file(s) Conflict:NA Reference:https://gitlab.com/libtiff/libtiff/-/commit/0cf67888e32e36b45828dd467920684c93f2b22d --- tools/tiffset.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/tiffset.c b/tools/tiffset.c index b7badd9..b8b52c0 100644 --- a/tools/tiffset.c +++ b/tools/tiffset.c @@ -148,15 +148,15 @@ main(int argc, char* argv[]) if (TIFFFieldDataType(fip) == TIFF_ASCII) { if(TIFFFieldPassCount( fip )) { size_t len; - len = (uint32_t)(strlen(argv[arg_index] + 1)); - if (TIFFSetField(tiff, TIFFFieldTag(fip), + len = strlen(argv[arg_index] + 1); + if (len > UINT16_MAX || TIFFSetField(tiff, TIFFFieldTag(fip), (uint16_t)len, argv[arg_index]) != 1) - fprintf( stderr, "Failed to set %s=%s", + fprintf( stderr, "Failed to set %s=%s\n", TIFFFieldName(fip), argv[arg_index] ); } else { if (TIFFSetField(tiff, TIFFFieldTag(fip), argv[arg_index]) != 1) - fprintf( stderr, "Failed to set %s=%s", + fprintf( stderr, "Failed to set %s=%s\n", TIFFFieldName(fip), argv[arg_index] ); } } else if (TIFFFieldWriteCount(fip) > 0 -- 2.33.0