1diff --git a/third_party/libtiff/tif_dirread.c b/third_party/libtiff/tif_dirread.c 2index bc4102184..0e3f8ccd4 100644 3--- a/third_party/libtiff/tif_dirread.c 4+++ b/third_party/libtiff/tif_dirread.c 5@@ -4983,6 +4983,11 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover) 6 if (err==TIFFReadDirEntryErrOk) 7 { 8 int m; 9+ if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' ) 10+ { 11+ TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name); 12+ data[dp->tdir_count-1] = '\0'; 13+ } 14 m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data); 15 if (data!=0) 16 _TIFFfree(data); 17@@ -5155,6 +5160,11 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover) 18 if (err==TIFFReadDirEntryErrOk) 19 { 20 int m; 21+ if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' ) 22+ { 23+ TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name); 24+ data[dp->tdir_count-1] = '\0'; 25+ } 26 m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); 27 if (data!=0) 28 _TIFFfree(data); 29