Fixed crash when 0 length packet was send to tunnel
Now UDP packets with 0 length are discarded without answer to sender. Minor
This commit is contained in:
parent
e0987aa83a
commit
0bbf7ad5e4
|
@ -139,7 +139,9 @@ int main(int argc, char** argv) {
|
||||||
radio.startListening();
|
radio.startListening();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//clean buffer
|
||||||
|
//buffer[0]='\0';
|
||||||
|
//memset(buffer, 0, sizeof(buffer));
|
||||||
|
|
||||||
}while(loop_on);
|
}while(loop_on);
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,10 @@ int main(int argc, char** argv){
|
||||||
inet_ntoa(cliaddr.sin_addr), // addrress
|
inet_ntoa(cliaddr.sin_addr), // addrress
|
||||||
ntohs(cliaddr.sin_port) // port
|
ntohs(cliaddr.sin_port) // port
|
||||||
);
|
);
|
||||||
|
if ( n ==0 ) {
|
||||||
|
printf("empty msg, discarded\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
printf("MSG: \'%s\'\n", buffer);
|
printf("MSG: \'%s\'\n", buffer);
|
||||||
|
|
||||||
|
|
||||||
|
@ -203,6 +207,10 @@ int main(int argc, char** argv){
|
||||||
(const struct sockaddr *) &cliaddr, cliaddr_len
|
(const struct sockaddr *) &cliaddr, cliaddr_len
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//clean buffer
|
||||||
|
//buffer[0]='\0';
|
||||||
|
//memset(buffer, 0, sizeof(buffer));
|
||||||
|
|
||||||
}while(loop_on);
|
}while(loop_on);
|
||||||
|
|
||||||
// Power down the antenna
|
// Power down the antenna
|
||||||
|
|
|
@ -63,5 +63,6 @@ do{
|
||||||
|
|
||||||
buffer[n] = '\0';
|
buffer[n] = '\0';
|
||||||
printf("ANS: \'%s\'\n", buffer);
|
printf("ANS: \'%s\'\n", buffer);
|
||||||
|
//buffer[0]='\0';
|
||||||
}while(loop_on);
|
}while(loop_on);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue