From 86d88fa24fd9712855373225d7dd55744ae0805d Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Fri, 9 Dec 2016 13:57:17 +1000 Subject: [PATCH] Broadcast port and address are now checked if valid before broadcasting --- bbs.c | 2 +- main.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bbs.c b/bbs.c index 8f800cf..8005e29 100644 --- a/bbs.c +++ b/bbs.c @@ -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)); diff --git a/main.c b/main.c index f12880b..574c058 100644 --- a/main.c +++ b/main.c @@ -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) {