[PATCH BlueZ 3/5] shared/util: Check arguments on util_memcpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux