All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/5] shared/util: Check arguments on util_memcpy
Date: Mon, 23 Jan 2023 15:56:47 -0800	[thread overview]
Message-ID: <20230123235649.3231488-3-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20230123235649.3231488-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This avoids having to check for !src or !len before calling util_memcpy
since otherwise it can cause runtime errors.
---
 src/shared/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/shared/util.c b/src/shared/util.c
index 69abfba31978..89f1a2623cc8 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -221,7 +221,7 @@ int util_iov_memcmp(const struct iovec *iov1, const struct iovec *iov2)
 
 void util_iov_memcpy(struct iovec *iov, void *src, size_t len)
 {
-	if (!iov)
+	if (!iov || !src || !len)
 		return;
 
 	iov->iov_base = realloc(iov->iov_base, len);
-- 
2.37.3


  parent reply	other threads:[~2023-01-23 23:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 23:56 [PATCH BlueZ 1/5] profiles: Add Support for Metadata, CID and VID Luiz Augusto von Dentz
2023-01-23 23:56 ` [PATCH BlueZ 2/5] client/player: Add support for Company ID, Vendor ID Luiz Augusto von Dentz
2023-01-23 23:56 ` Luiz Augusto von Dentz [this message]
2023-01-23 23:56 ` [PATCH BlueZ 4/5] media-api: Make Vendor a uint32_t Luiz Augusto von Dentz
2023-01-23 23:56 ` [PATCH BlueZ 5/5] media: Rework support of Vendor to use uint32_t as type Luiz Augusto von Dentz
2023-01-24  2:54 ` [BlueZ,1/5] profiles: Add Support for Metadata, CID and VID bluez.test.bot
2023-02-01  1:10 ` [PATCH BlueZ 1/5] " patchwork-bot+bluetooth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230123235649.3231488-3-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.