Skip to content

Commit

Permalink
FIX: Buffer overflow in banner grabber
Browse files Browse the repository at this point in the history
  • Loading branch information
matricali committed Feb 21, 2024
1 parent b855a89 commit 13035dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/detection.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ int detection_detect_ssh(btkg_context_t *ctx, const char *hostname,
if (banner_len > 0) {
if (banner_len > BANNER_LEN)
banner_len = BANNER_LEN;
strncpy(banner, buffer, banner_len);
banner[banner_len] = 0;
strncpy(banner, buffer, banner_len - 1);
banner[banner_len - 1] = 0;
}

if (strstr(banner, "SSH-") != banner) {
Expand Down

0 comments on commit 13035dc

Please sign in to comment.