mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-02-10 22:33:33 -05:00
plugins/check_real.c - recv string null terminate
Recv into buffer is not properly null terminated prior to strstr and possible other string functions expecting a null termination. Simply take bytes received and use as an index to append \0 after. We are creating buffer[] with size of MAX_INPUT_BUFFER and recv with MAX_INPUT_BUFFER-1 so this should never overflow.
This commit is contained in:
parent
9ce73696b0
commit
b61f51ad02
1 changed files with 1 additions and 0 deletions
|
|
@ -178,6 +178,7 @@ main (int argc, char **argv)
|
|||
|
||||
/* watch for the REAL connection string */
|
||||
result = recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0);
|
||||
buffer[result] = "\0"; /* null terminate recieved buffer */
|
||||
|
||||
/* return a CRITICAL status if we couldn't read any data */
|
||||
if (result == -1) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue