Skip to content

Commit

Permalink
Fix CID 1547465: Integer handling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ni4 authored and antonsviridenko committed Jul 28, 2024
1 parent dcbfe13 commit e3662a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librepgp/stream-armor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1154,10 +1154,10 @@ pgp_source_t::is_cleartext()
char buf[ARMORED_PEEK_BUF_SIZE] = {0};
size_t read = 0;

if (!peek(buf, sizeof(buf), &read) || (read < strlen(ST_CLEAR_BEGIN))) {
if (!peek(buf, sizeof(buf) - 1, &read) || (read < strlen(ST_CLEAR_BEGIN))) {
return false;
}
buf[read - 1] = 0;
buf[read] = 0;
return !!strstr(buf, ST_CLEAR_BEGIN);
}

Expand Down

0 comments on commit e3662a7

Please sign in to comment.