mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-05-28 04:35:40 -04:00
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
This commit is contained in:
commit
c39de8869e
1 changed files with 4 additions and 1 deletions
|
|
@ -402,7 +402,10 @@ get_ups_variable (const char *varname, char *buf, size_t buflen)
|
|||
|
||||
/* create the command string to send to the UPS daemon */
|
||||
/* Add LOGOUT to avoid read failure logs */
|
||||
sprintf (send_buffer, "GET VAR %s %s\nLOGOUT\n", ups_name, varname);
|
||||
if (snprintf (send_buffer, sizeof(send_buffer), "GET VAR %s %s\nLOGOUT\n", ups_name, varname) >= sizeof(send_buffer)) {
|
||||
printf("%s\n", _("UPS name to long for buffer"));
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* send the command to the daemon and get a response back */
|
||||
if (process_tcp_request
|
||||
|
|
|
|||
Loading…
Reference in a new issue