Browse Source

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.
zrythm_meson
David Robillard 1 year ago
parent
commit
1425490822
  1. 6
      src/node.c

6
src/node.c

@ -195,12 +195,12 @@ serd_node_new_file_uri(const uint8_t* path, @@ -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) {

Loading…
Cancel
Save