diff options
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/check_ssh.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c index 9d0d7cde..2c76fa84 100644 --- a/plugins/check_ssh.c +++ b/plugins/check_ssh.c | |||
| @@ -255,7 +255,7 @@ 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 | unsigned long len = 0; | 258 | size_t len = 0; |
| 259 | while ((index = strchr(output + byte_offset, '\n')) != NULL) { | 259 | while ((index = strchr(output + byte_offset, '\n')) != NULL) { |
| 260 | /*Partition the buffer so that this line is a separate string, | 260 | /*Partition the buffer so that this line is a separate string, |
| 261 | * by replacing the newline with NUL*/ | 261 | * by replacing the newline with NUL*/ |
| @@ -273,12 +273,14 @@ int ssh_connect(mp_check *overall, char *haddr, int hport, char *desired_remote_ | |||
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | if (version_control_string == NULL) { | 275 | if (version_control_string == NULL) { |
| 276 | /* move unconsumed data to beginning of buffer, null rest */ | 276 | /* move unconsumed data to beginning of buffer */ |
| 277 | memmove((void *)output, (void *)(output + byte_offset + 1), BUFF_SZ - len + 1); | 277 | memmove((void *)output, (void *)(output + byte_offset), BUFF_SZ - byte_offset); |
| 278 | memset(output + byte_offset + 1, 0, BUFF_SZ - byte_offset + 1); | ||
| 279 | 278 | ||
| 280 | /*start reading from end of current line chunk on next recv*/ | 279 | /*start reading from end of current line chunk on next recv*/ |
| 281 | byte_offset = strlen(output); | 280 | byte_offset = strlen(output); |
| 281 | |||
| 282 | /* NUL the rest of the buffer */ | ||
| 283 | memset(output + byte_offset, 0, BUFF_SZ - byte_offset); | ||
| 282 | } | 284 | } |
| 283 | } else { | 285 | } else { |
| 284 | byte_offset += recv_ret; | 286 | byte_offset += recv_ret; |
