summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2021-11-24 23:56:27 (GMT)
committerGitHub <noreply@github.com>2021-11-24 23:56:27 (GMT)
commitc39de8869e5352a5503607258996b8461ff27c14 (patch)
tree6738b91799d8fe2c7885c1835ddd4ed4e2c71380 /plugins
parent0e311b77d93df4b97c5f8cff73fea74a442ed4bc (diff)
parent09bfb1b482f428b1c11f68b5be7d134ba5e3b457 (diff)
downloadmonitoring-plugins-c39de8869e5352a5503607258996b8461ff27c14.tar.gz
Merge pull request #1727 from phibos/fix_check_ups_1030
Fix possible overflow in check_ups. Looks good to me too, thank you very much
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_ups.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index e9e56a5..0de37a2 100644
--- a/plugins/check_ups.c
+++ b/plugins/check_ups.c
@@ -402,7 +402,10 @@ get_ups_variable (const char *varname, char *buf, size_t buflen)
402 402
403 /* create the command string to send to the UPS daemon */ 403 /* create the command string to send to the UPS daemon */
404 /* Add LOGOUT to avoid read failure logs */ 404 /* Add LOGOUT to avoid read failure logs */
405 sprintf (send_buffer, "GET VAR %s %s\nLOGOUT\n", ups_name, varname); 405 if (snprintf (send_buffer, sizeof(send_buffer), "GET VAR %s %s\nLOGOUT\n", ups_name, varname) >= sizeof(send_buffer)) {
406 printf("%s\n", _("UPS name to long for buffer"));
407 return ERROR;
408 }
406 409
407 /* send the command to the daemon and get a response back */ 410 /* send the command to the daemon and get a response back */
408 if (process_tcp_request 411 if (process_tcp_request