Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Commit a006d34

Browse files
Norbert Pocscryptomilk
authored andcommitted
buffer.c: Fix null pointer dereference error
This issue was discovered by covscan tool. Signed-off-by: Norbert Pocs <npocs@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
1 parent a669408 commit a006d34

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/buffer.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,8 @@ uint32_t ssh_buffer_get_u64(struct ssh_buffer_struct *buffer, uint64_t *data){
748748
*/
749749
int ssh_buffer_validate_length(struct ssh_buffer_struct *buffer, size_t len)
750750
{
751-
if (buffer->pos + len < len || buffer->pos + len > buffer->used) {
751+
if (buffer == NULL || buffer->pos + len < len ||
752+
buffer->pos + len > buffer->used) {
752753
return SSH_ERROR;
753754
}
754755

0 commit comments

Comments
 (0)