Skip to content

Commit

Permalink
Add an extra check on CGATS
Browse files Browse the repository at this point in the history
I wonder who would care on that aside fuzzers.
  • Loading branch information
mm2 committed May 1, 2024
1 parent 736a762 commit 84b3dd9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/cmscgats.c
Original file line number Diff line number Diff line change
Expand Up @@ -1243,9 +1243,12 @@ void* AllocChunk(cmsIT8* it8, cmsUInt32Number size)
static
char *AllocString(cmsIT8* it8, const char* str)
{
cmsUInt32Number Size = (cmsUInt32Number) strlen(str)+1;
cmsUInt32Number Size;
char *ptr;

if (str == NULL) return NULL;

Size = (cmsUInt32Number)strlen(str) + 1;

ptr = (char *) AllocChunk(it8, Size);
if (ptr) memcpy(ptr, str, Size-1);
Expand Down Expand Up @@ -1328,6 +1331,11 @@ KEYVALUE* AddToList(cmsIT8* it8, KEYVALUE** Head, const char *Key, const char *S
// Store name and value
p->Keyword = AllocString(it8, Key);
p->Subkey = (Subkey == NULL) ? NULL : AllocString(it8, Subkey);
if (p->Keyword == NULL || p->Subkey == NULL)
{
SynError(it8, "AddToList: out of memory");
return NULL;
}

// Keep the container in our list
if (*Head == NULL) {
Expand Down

0 comments on commit 84b3dd9

Please sign in to comment.