From: Markus Großer <markus.grosser2+git@gmail.com>
Date: Sat, 18 Nov 2017 15:26:08 +0000 (+0100)
Subject: Add check for MAX_DEVICES to STEMlab discovery
X-Git-Url: https://git.rkrishnan.org/pf/content/%22file:/...?a=commitdiff_plain;h=7755b54fd9a8104cd39d0a52d83f9c7c8ccc9ca4;p=pihpsdr.git

Add check for MAX_DEVICES to STEMlab discovery
---

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;