mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-11 13:16:08 +00:00
Added some extra checks for memory corruption (of course now that I
am looking, the problem is not happening).
This commit is contained in:
parent
ce2afbe2ab
commit
3fed04e6cd
@ -124,7 +124,7 @@ int overlayServerMode()
|
|||||||
while(1) {
|
while(1) {
|
||||||
/* Work out how long we can wait before we need to tick */
|
/* Work out how long we can wait before we need to tick */
|
||||||
long long ms=overlay_time_until_next_tick();
|
long long ms=overlay_time_until_next_tick();
|
||||||
|
memabuseCheck();
|
||||||
int filesPresent=0;
|
int filesPresent=0;
|
||||||
fds[0].fd=sock; fds[0].events=POLLIN;
|
fds[0].fd=sock; fds[0].events=POLLIN;
|
||||||
fdcount=1;
|
fdcount=1;
|
||||||
|
@ -245,9 +245,20 @@ overlay_neighbour *overlay_neighbours=NULL;
|
|||||||
int overlay_route_hash_order[16];
|
int overlay_route_hash_order[16];
|
||||||
int overlay_route_hash_bytes=0;
|
int overlay_route_hash_bytes=0;
|
||||||
|
|
||||||
|
int overlay_route_initP=0;
|
||||||
int overlay_route_init(int mb_ram)
|
int overlay_route_init(int mb_ram)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
|
/* Try to catch one observed behaviour when memory corruption has occurred. */
|
||||||
|
if (overlay_route_initP) {
|
||||||
|
fprintf(stderr,"ERROR: overlay_route_init() multiply called.\n");
|
||||||
|
sleep(3600);
|
||||||
|
}
|
||||||
|
overlay_route_initP=1;
|
||||||
|
|
||||||
|
memabuseCheck();
|
||||||
|
|
||||||
/* XXX Initialise the random number generator in a robust manner */
|
/* XXX Initialise the random number generator in a robust manner */
|
||||||
fprintf(stderr,"WARNING: RNG Not Securely Initialised.\n");
|
fprintf(stderr,"WARNING: RNG Not Securely Initialised.\n");
|
||||||
|
|
||||||
|
14
server.c
14
server.c
@ -663,16 +663,26 @@ int simpleServerMode()
|
|||||||
|
|
||||||
#ifdef DEBUG_MEM_ABUSE
|
#ifdef DEBUG_MEM_ABUSE
|
||||||
unsigned char groundzero[65536];
|
unsigned char groundzero[65536];
|
||||||
|
int memabuseInitP=0;
|
||||||
|
|
||||||
int memabuseInit()
|
int memabuseInit()
|
||||||
{
|
{
|
||||||
|
if (memabuseInitP) {
|
||||||
|
fprintf(stderr,"WARNING: memabuseInit() called more than once.\n");
|
||||||
|
return memabuseCheck();
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char *zero=(unsigned char *)0;
|
unsigned char *zero=(unsigned char *)0;
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<65536;i++) groundzero[i]=zero[i];
|
for(i=0;i<65536;i++) {
|
||||||
|
groundzero[i]=zero[i];
|
||||||
|
printf("%04x\n",i);
|
||||||
|
}
|
||||||
|
memabuseInitP=1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int memabuseCheck(char *func,char *file,int line)
|
int _memabuseCheck(const char *func,const char *file,const int line)
|
||||||
{
|
{
|
||||||
unsigned char *zero=(unsigned char *)0;
|
unsigned char *zero=(unsigned char *)0;
|
||||||
int firstAddr=-1;
|
int firstAddr=-1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user