mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-21 17:11:58 +00:00
Add more bounds checking in copernicus
This commit is contained in:
parent
517242df47
commit
663b320868
@ -31,6 +31,8 @@ int add_uuid(char* destination, int maxsize) {
|
||||
strncpy(destination, "/uuid=", maxsize);
|
||||
uuidsize = read(uuidf, destination + 6, maxsize - 6);
|
||||
close(uuidf);
|
||||
if (uuidsize < 0) { return 0; }
|
||||
if (uuidsize > 524288) { return 0; }
|
||||
if (destination[uuidsize + 5] == '\n') {
|
||||
destination[uuidsize + 5 ] = 0;
|
||||
}
|
||||
@ -42,9 +44,11 @@ int add_confluent_uuid(char* destination, int maxsize) {
|
||||
int uuidsize;
|
||||
uuidf = open("/confluent_uuid", O_RDONLY);
|
||||
if (uuidf < 0) { return 0; }
|
||||
strncpy(destination, "/confluentuuid=", maxsize);
|
||||
uuidsize = read(uuidf, destination + 15, maxsize - 15);
|
||||
close(uuidf);
|
||||
if (uuidsize < 0) { return 0; }
|
||||
if (uuidsize > 524288) { return 0; }
|
||||
strncpy(destination, "/confluentuuid=", maxsize);
|
||||
if (destination[uuidsize + 14] == '\n') {
|
||||
destination[uuidsize + 14] = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user