mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-16 12:06:55 +02:00
More stack->heap
This commit is contained in:
parent
e2900f4f3c
commit
c5a07c7f20
1 changed files with 10 additions and 5 deletions
|
@ -2455,11 +2455,16 @@ public:
|
|||
// little effect on others.
|
||||
f = fopen(p,"rb");
|
||||
if (f) {
|
||||
char buf[65535];
|
||||
long l = (long)fread(buf,1,sizeof(buf),f);
|
||||
fclose(f);
|
||||
if ((l == (long)len)&&(memcmp(data,buf,l) == 0))
|
||||
return;
|
||||
char *const buf = (char *)malloc(len*4);
|
||||
if (buf) {
|
||||
long l = (long)fread(buf,1,(size_t)(len*4),f);
|
||||
fclose(f);
|
||||
if ((l == (long)len)&&(memcmp(data,buf,l) == 0)) {
|
||||
free(buf);
|
||||
return;
|
||||
}
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
f = fopen(p,"wb");
|
||||
|
|
Loading…
Add table
Reference in a new issue