aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-10 17:00:09 +0100
committerDavid Robillard <d@drobilla.net>2021-01-10 20:00:28 +0100
commit1425490822eef5125b26cd093f303b1afefe6365 (patch)
tree30bc2385251fc1ec94c929833beb3dafcc3e20c8
parent2146e945d2d90112054bcb7f557e875594f167ac (diff)
downloadserd-1425490822eef5125b26cd093f303b1afefe6365.tar.gz
serd-1425490822eef5125b26cd093f303b1afefe6365.tar.bz2
serd-1425490822eef5125b26cd093f303b1afefe6365.zip
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.
-rw-r--r--src/node.c6
1 files 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) {