2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 01:22:00 +00:00

Add more bounds checking in copernicus

This commit is contained in:
Jarrod Johnson 2024-06-07 12:43:15 -04:00
parent 517242df47
commit 663b320868

View File

@ -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;
}