summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-08-01 14:35:13 +0200
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-08-01 14:35:13 +0200
commita69dff15222ad43c56f0142e20d97ee51c2e6697 (patch)
treeaf2e273721d310fa097c3083d95dc71b3a14759d
parent3c53bf623d89650ac450be2518d17276a29247cc (diff)
downloadmonitoring-plugins-a69dff15.tar.gz
check_ssh: Put variable in the correct scope
-rw-r--r--plugins/check_ssh.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index af7089a7..b4a98cdf 100644
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
@@ -255,12 +255,11 @@ int ssh_connect(mp_check *overall, char *haddr, int hport, char *desired_remote_
255 byte_offset = 0; 255 byte_offset = 0;
256 256
257 char *index = NULL; 257 char *index = NULL;
258 size_t len = 0;
259 while ((index = strchr(output + byte_offset, '\n')) != NULL) { 258 while ((index = strchr(output + byte_offset, '\n')) != NULL) {
260 /*Partition the buffer so that this line is a separate string, 259 /*Partition the buffer so that this line is a separate string,
261 * by replacing the newline with NUL*/ 260 * by replacing the newline with NUL*/
262 output[(index - output)] = '\0'; 261 output[(index - output)] = '\0';
263 len = strlen(output + byte_offset); 262 size_t len = strlen(output + byte_offset);
264 263
265 if ((len >= 4) && (strncmp(output + byte_offset, "SSH-", 4) == 0)) { 264 if ((len >= 4) && (strncmp(output + byte_offset, "SSH-", 4) == 0)) {
266 /*if the string starts with SSH-, this _should_ be a valid version control string*/ 265 /*if the string starts with SSH-, this _should_ be a valid version control string*/