From 1425490822eef5125b26cd093f303b1afefe6365 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 10 Jan 2021 17:00:09 +0100 Subject: Avoid use of strcpy Again, really just skirting around warnings here, but this is faster anyway since we know what we're doing here and doing require any fine-grained null termination. --- src/node.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node.c b/src/node.c index 4750a83a..02aedbf2 100644 --- a/src/node.c +++ b/src/node.c @@ -195,12 +195,12 @@ serd_node_new_file_uri(const uint8_t* path, if (path[0] == '/' || is_windows) { uri_len = strlen("file://") + hostname_len + is_windows; - uri = (uint8_t*)malloc(uri_len + 1); + uri = (uint8_t*)calloc(uri_len + 1, 1); - strcpy((char*)uri, "file://"); + memcpy(uri, "file://", 7); if (hostname) { - strcpy((char*)uri + 7, (char*)hostname); + memcpy(uri + 7, hostname, hostname_len); } if (is_windows) { -- cgit v1.2.1