mirror of
https://github.com/vivier/EMILE.git
synced 2025-03-11 08:32:45 +00:00
Check header signature
This commit is contained in:
parent
f9dcbc903f
commit
a10615bd87
@ -22,6 +22,9 @@ char* emile_second_get_configuration(int fd)
|
||||
if (ret != sizeof(header))
|
||||
return NULL;
|
||||
|
||||
if (!EMILE_COMPAT(EMILE_06_SIGNATURE, read_long(&header.signature)))
|
||||
return NULL;
|
||||
|
||||
size = read_short(&header.conf_size);
|
||||
conf = (char*)malloc(size);
|
||||
if (conf == NULL)
|
||||
|
@ -30,9 +30,12 @@ int emile_second_set_configuration(int fd, char *configuration)
|
||||
if (ret != sizeof(header))
|
||||
return EEMILE_CANNOT_READ_SECOND;
|
||||
|
||||
if (!EMILE_COMPAT(EMILE_06_SIGNATURE, read_long(&header.signature)))
|
||||
return EEMILE_INVALID_SECOND;
|
||||
|
||||
size = read_short(&header.conf_size);
|
||||
if (len > size)
|
||||
return EEMILE_CANNOT_READ_SECOND;
|
||||
return EEMILE_INVALID_SECOND;
|
||||
|
||||
ret = write(fd, configuration, len);
|
||||
if (ret != len)
|
||||
|
Loading…
x
Reference in New Issue
Block a user