1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Merge pull request #1832 from chipitsine/master

src/Cedar/Server.c: fix race condition
This commit is contained in:
Ilya Shipitsin 2023-05-13 20:42:38 +02:00 committed by GitHub
commit 2fdd9ec4dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1092,10 +1092,15 @@ UINT GetServerCapsInt(SERVER *s, char *name)
return 0; return 0;
} }
Lock(s->CapsCacheLock);
{
Zero(&t, sizeof(t)); Zero(&t, sizeof(t));
GetServerCaps(s, &t); GetServerCaps(s, &t);
ret = GetCapsInt(&t, name); ret = GetCapsInt(&t, name);
}
Unlock(s->CapsCacheLock);
return ret; return ret;
} }
@ -1164,10 +1169,14 @@ void FlushServerCaps(SERVER *s)
return; return;
} }
Lock(s->CapsCacheLock);
{
DestroyServerCapsCache(s); DestroyServerCapsCache(s);
Zero(&t, sizeof(t)); Zero(&t, sizeof(t));
GetServerCaps(s, &t); GetServerCaps(s, &t);
}
Unlock(s->CapsCacheLock);
} }
// Get the Caps list for this server // Get the Caps list for this server