Broadcast port and address are now checked if valid before broadcasting

This commit is contained in:
Andrew Pamment 2016-12-09 13:57:17 +10:00
parent 730d60d02c
commit 86d88fa24f
2 changed files with 3 additions and 1 deletions

2
bbs.c
View File

@ -52,7 +52,7 @@ void broadcast(char *mess, ...) {
if (conf.broadcast_enable) {
if (conf.broadcast_enable && conf.broadcast_port > 1024 && conf.broadcast_port < 65536 && conf.broadcast_address != NULL) {
bcast_sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
ret=setsockopt(bcast_sock, SOL_SOCKET, SO_BROADCAST, &broadcastEnable, sizeof(broadcastEnable));

2
main.c
View File

@ -853,6 +853,8 @@ int main(int argc, char **argv) {
conf.archiver_path = NULL;
conf.archiver_count = 0;
conf.broadcast_enable = 0;
conf.broadcast_port = 0;
conf.broadcast_address = NULL;
// Load BBS data
if (ini_parse(argv[1], handler, &conf) <0) {