File reproducible.patch of Package lcms2
Index: lcms2-2.9/src/cmsio0.c
===================================================================
--- lcms2-2.9.orig/src/cmsio0.c
+++ lcms2-2.9/src/cmsio0.c
@@ -424,6 +424,7 @@ cmsIOHANDLER* CMSEXPORT cmsOpenIOhandler
iohandler ->UsedSpace = 0;
// Keep track of the original file
+ memset(iohandler -> PhysicalFile, 0, sizeof(iohandler -> PhysicalFile));
strncpy(iohandler -> PhysicalFile, FileName, sizeof(iohandler -> PhysicalFile)-1);
iohandler -> PhysicalFile[sizeof(iohandler -> PhysicalFile)-1] = 0;
@@ -783,6 +784,7 @@ cmsBool _cmsWriteHeader(_cmsICCPROFILE*
cmsTagEntry Tag;
cmsUInt32Number Count;
+ memset(&Header, 0, sizeof(Header));
Header.size = _cmsAdjustEndianess32(UsedSpace);
Header.cmmId = _cmsAdjustEndianess32(lcmsSignature);
Header.version = _cmsAdjustEndianess32(Icc ->Version);
Index: lcms2-2.9/src/cmscgats.c
===================================================================
--- lcms2-2.9.orig/src/cmscgats.c
+++ lcms2-2.9/src/cmscgats.c
@@ -984,12 +984,12 @@ cmsBool GetVal(cmsIT8* it8, char* Buffer
case SEOLN: // Empty value
Buffer[0]=0;
break;
- case SIDENT: strncpy(Buffer, it8->id, max);
+ case SIDENT: memset(Buffer, 0, max); strncpy(Buffer, it8->id, max);
Buffer[max-1]=0;
break;
case SINUM: snprintf(Buffer, max, "%d", it8 -> inum); break;
case SDNUM: snprintf(Buffer, max, it8->DoubleFormatter, it8 -> dnum); break;
- case SSTRING: strncpy(Buffer, it8->str, max);
+ case SSTRING: memset(Buffer, 0, max); strncpy(Buffer, it8->str, max);
Buffer[max-1] = 0;
break;
@@ -1337,7 +1337,6 @@ const char* CMSEXPORT cmsIT8GetSheetType
cmsBool CMSEXPORT cmsIT8SetSheetType(cmsHANDLE hIT8, const char* Type)
{
TABLE* t = GetTable((cmsIT8*) hIT8);
-
strncpy(t ->SheetType, Type, MAXSTR-1);
t ->SheetType[MAXSTR-1] = 0;
return TRUE;
@@ -1956,6 +1955,7 @@ cmsBool HeaderSection(cmsIT8* it8)
case SIDENT:
+ memset(VarName, 0, MAXID);
strncpy(VarName, it8->id, MAXID - 1);
VarName[MAXID - 1] = 0;
@@ -2321,6 +2321,7 @@ cmsHANDLE CMSEXPORT cmsIT8LoadFromMem(c
it8 = (cmsIT8*) hIT8;
it8 ->MemoryBlock = (char*) _cmsMalloc(ContextID, len + 1);
+ memset(it8 ->MemoryBlock, 0, len);
strncpy(it8 ->MemoryBlock, (const char*) Ptr, len);
it8 ->MemoryBlock[len] = 0;
Index: lcms2-2.9/src/cmsnamed.c
===================================================================
--- lcms2-2.9.orig/src/cmsnamed.c
+++ lcms2-2.9/src/cmsnamed.c
@@ -544,6 +544,7 @@ cmsNAMEDCOLORLIST* CMSEXPORT cmsAllocNam
}
strncpy(v ->Prefix, Prefix, sizeof(v ->Prefix)-1);
+ memset(v ->Suffix, 0, sizeof(v ->Suffix));
strncpy(v ->Suffix, Suffix, sizeof(v ->Suffix)-1);
v->Prefix[32] = v->Suffix[32] = 0;
@@ -604,6 +605,7 @@ cmsBool CMSEXPORT cmsAppendNamedColor(c
if (Name != NULL) {
+ memset(NamedColorList ->List[NamedColorList ->nColors].Name, 0, cmsMAX_PATH);
strncpy(NamedColorList ->List[NamedColorList ->nColors].Name, Name, cmsMAX_PATH-1);
NamedColorList ->List[NamedColorList ->nColors].Name[cmsMAX_PATH-1] = 0;
Index: lcms2-2.9/src/cmstypes.c
===================================================================
--- lcms2-2.9.orig/src/cmstypes.c
+++ lcms2-2.9/src/cmstypes.c
@@ -3174,7 +3174,9 @@ cmsBool Type_NamedColor_Write(struct _cm
if (!_cmsWriteUInt32Number(io, nColors)) return FALSE;
if (!_cmsWriteUInt32Number(io, NamedColorList ->ColorantCount)) return FALSE;
+ memset(prefix, 0, 32);
strncpy(prefix, (const char*) NamedColorList->Prefix, 32);
+ memset(suffix, 0, 32);
strncpy(suffix, (const char*) NamedColorList->Suffix, 32);
suffix[32] = prefix[32] = 0;
Index: lcms2-2.9/src/cmsps2.c
===================================================================
--- lcms2-2.9.orig/src/cmsps2.c
+++ lcms2-2.9/src/cmsps2.c
@@ -333,6 +333,7 @@ char* RemoveCR(const char* txt)
static char Buffer[2048];
char* pt;
+ memset(Buffer, 0, sizeof(Buffer));
strncpy(Buffer, txt, 2047);
Buffer[2047] = 0;
for (pt = Buffer; *pt; pt++)