Broadcast port and address are now checked if valid before broadcasting
This commit is contained in:
parent
730d60d02c
commit
86d88fa24f
2
bbs.c
2
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);
|
bcast_sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
ret=setsockopt(bcast_sock, SOL_SOCKET, SO_BROADCAST, &broadcastEnable, sizeof(broadcastEnable));
|
ret=setsockopt(bcast_sock, SOL_SOCKET, SO_BROADCAST, &broadcastEnable, sizeof(broadcastEnable));
|
||||||
|
|
||||||
|
2
main.c
2
main.c
@ -853,6 +853,8 @@ int main(int argc, char **argv) {
|
|||||||
conf.archiver_path = NULL;
|
conf.archiver_path = NULL;
|
||||||
conf.archiver_count = 0;
|
conf.archiver_count = 0;
|
||||||
conf.broadcast_enable = 0;
|
conf.broadcast_enable = 0;
|
||||||
|
conf.broadcast_port = 0;
|
||||||
|
conf.broadcast_address = NULL;
|
||||||
|
|
||||||
// Load BBS data
|
// Load BBS data
|
||||||
if (ini_parse(argv[1], handler, &conf) <0) {
|
if (ini_parse(argv[1], handler, &conf) <0) {
|
||||||
|
Reference in New Issue
Block a user