Skip to content

Commit

Permalink
lib: zero receive buffer
Browse files Browse the repository at this point in the history
This is not strictly needed as we only use the part that was correctly
written by recv(), but it helps static tool analysis.
  • Loading branch information
vincentbernat committed Sep 18, 2022
1 parent 168111b commit e19e50f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ _lldpctl_needs(lldpctl_conn_t *conn, size_t length)
uint8_t *buffer;
ssize_t rc;

if ((buffer = malloc(length)) == NULL)
if ((buffer = calloc(1, length)) == NULL)
return SET_ERROR(conn, LLDPCTL_ERR_NOMEM);
rc = conn->recv(conn, buffer, length, conn->user_data);
if (rc < 0) {
Expand Down

0 comments on commit e19e50f

Please sign in to comment.