[libdispatch-dev] [PATCH 4/4] do not use strlcpy

Paolo Bonzini bonzini at gnu.org
Tue Nov 10 03:23:13 PST 2009


---
 src/source.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/source.c b/src/source.c
index 01061a4..95c9b5d 100644
--- a/src/source.c
+++ b/src/source.c
@@ -391,6 +391,7 @@ dispatch_source_create(dispatch_source_type_t type,
 	dispatch_queue_t q)
 {
 	dispatch_source_t ds = NULL;
+	static char source_label[sizeof ds->dq_label] = "source";
 
 	// input validation
 	if (type == NULL || (mask & ~type->mask)) {
@@ -404,7 +405,7 @@ dispatch_source_create(dispatch_source_type_t type,
 
 	// Initialize as a queue first, then override some settings below.
 	_dispatch_queue_init((dispatch_queue_t)ds);
-	strlcpy(ds->dq_label, "source", sizeof(ds->dq_label));
+	memcpy(ds->dq_label, source_label, sizeof source_label);
 
 	// Dispatch Object
 	ds->do_vtable = &_dispatch_source_kevent_vtable;
-- 
1.6.2.5




More information about the libdispatch-dev mailing list