Merge branch 'jk/remote-curl-an-array-in-struct-cannot-be-null' into maint
[gitweb.git] / transport.c
index 70d38e4c4b35c6207e226ab7cb54095c34bb4766..08bcd3a4eba42d2e72b9d84ec89e190c763300fa 100644 (file)
@@ -971,9 +971,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
        } else {
                /* Unknown protocol in URL. Pass to external handler. */
                int len = external_specification_len(url);
-               char *handler = xmalloc(len + 1);
-               handler[len] = 0;
-               strncpy(handler, url, len);
+               char *handler = xmemdupz(url, len);
                transport_helper_init(ret, handler);
        }