diff options
author | David Robillard <d@drobilla.net> | 2021-01-10 17:00:09 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-01-10 20:00:28 +0100 |
commit | 1425490822eef5125b26cd093f303b1afefe6365 (patch) | |
tree | 30bc2385251fc1ec94c929833beb3dafcc3e20c8 | |
parent | 2146e945d2d90112054bcb7f557e875594f167ac (diff) | |
download | serd-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.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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) { |