mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-22 14:32:25 +00:00
further checks against corrupt hlr
This commit is contained in:
parent
d90b921188
commit
5778e9d016
5
dna.c
5
dna.c
@ -74,7 +74,7 @@ struct mphlr_variable vars[]={
|
|||||||
{0x00,NULL,NULL}
|
{0x00,NULL,NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
int sock;
|
int sock=-1;
|
||||||
|
|
||||||
#ifndef HAVE_BZERO
|
#ifndef HAVE_BZERO
|
||||||
/* OpenWRT doesn't have bzero */
|
/* OpenWRT doesn't have bzero */
|
||||||
@ -275,6 +275,7 @@ char *exec_args[128];
|
|||||||
int exec_argc=0;
|
int exec_argc=0;
|
||||||
void signal_handler( int signal ) {
|
void signal_handler( int signal ) {
|
||||||
/* oops - caught a bad signal -- exec() ourselves fresh */
|
/* oops - caught a bad signal -- exec() ourselves fresh */
|
||||||
|
if (sock>-1) close(sock);
|
||||||
execv(exec_args[0],exec_args);
|
execv(exec_args[0],exec_args);
|
||||||
/* Quit if the exec() fails */
|
/* Quit if the exec() fails */
|
||||||
exit(-3);
|
exit(-3);
|
||||||
@ -304,7 +305,7 @@ int main(int argc,char **argv)
|
|||||||
signal( SIGFPE, signal_handler );
|
signal( SIGFPE, signal_handler );
|
||||||
signal( SIGILL, signal_handler );
|
signal( SIGILL, signal_handler );
|
||||||
signal( SIGBUS, signal_handler );
|
signal( SIGBUS, signal_handler );
|
||||||
|
signal( SIGABRT, signal_handler );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
srandomdev();
|
srandomdev();
|
||||||
|
@ -241,6 +241,8 @@ int hlrGetRecordLength(unsigned char *hlr,int hofs)
|
|||||||
|
|
||||||
if (debug>2) fprintf(stderr,"HLR record @ 0x%x is %d bytes long.\n",hofs,record_length);
|
if (debug>2) fprintf(stderr,"HLR record @ 0x%x is %d bytes long.\n",hofs,record_length);
|
||||||
|
|
||||||
|
if (record_length<0) return 0;
|
||||||
|
|
||||||
return record_length;
|
return record_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user