buf_puts: uses memcpy as it may be optimized

Sat, 12 Dec 2020 21:50:23 +0100

author
David Demelier <markand@malikania.fr>
date
Sat, 12 Dec 2020 21:50:23 +0100
changeset 13
3e1c384e0d3f
parent 12
ef83533c3417
child 14
1297027290b9

buf_puts: uses memcpy as it may be optimized

buf-puts.c file | annotate | diff | comparison | revisions
--- a/buf-puts.c	Fri Oct 30 13:28:46 2020 +0100
+++ b/buf-puts.c	Sat Dec 12 21:50:23 2020 +0100
@@ -33,7 +33,7 @@
 	if (!_buf_grow(b, len))
 		return false;
 
-	strcpy(&b->data[b->length], s);
+	memcpy(&b->data[b->length], s, len + 1);
 	b->length += len;
 
 	return true;

mercurial