From 7755b54fd9a8104cd39d0a52d83f9c7c8ccc9ca4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Markus=20Gro=C3=9Fer?= Date: Sat, 18 Nov 2017 16:26:08 +0100 Subject: [PATCH] Add check for MAX_DEVICES to STEMlab discovery --- stemlab_discovery.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stemlab_discovery.c b/stemlab_discovery.c index 154d923..5e8e705 100644 --- a/stemlab_discovery.c +++ b/stemlab_discovery.c @@ -188,6 +188,10 @@ static void new_service_cb(GaServiceBrowser *browser, gint if_index, GaProtocol if (1 != sscanf(name, "rp-%6x HTTP", &mac_buffer)) { return; } + if (devices >= MAX_DEVICES) { + fprintf(stderr, ERROR_PREFIX "Maximum number of devices (%d) reached\n", + MAX_DEVICES); + } if (protocol != AVAHI_PROTO_INET) { fprintf(stderr, ERROR_PREFIX "found %.9s via IPv6, skipping ...\n", name); return; -- 2.45.2