From: Vincent Bernat Date: Sun, 18 Sep 2022 08:03:43 +0000 (+0200) Subject: lib: zero receive buffer X-Git-Tag: 1.0.16~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e19e50f6a99a0e5d295eba91309e5573b744be56;p=thirdparty%2Flldpd.git lib: zero receive buffer This is not strictly needed as we only use the part that was correctly written by recv(), but it helps static tool analysis. --- diff --git a/src/lib/connection.c b/src/lib/connection.c index 2eed5a4b..e1acce0f 100644 --- a/src/lib/connection.c +++ b/src/lib/connection.c @@ -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) {