diff --git a/test/core/httpcli/httpcli_test.c b/test/core/httpcli/httpcli_test.c
index fc51cb010114b3ed7cd850e9d3a0cb38902d73e7..612388c61d7b5d212b0e5c08d3cf9abe543d79fd 100644
--- a/test/core/httpcli/httpcli_test.c
+++ b/test/core/httpcli/httpcli_test.c
@@ -151,11 +151,11 @@ int main(int argc, char **argv) {
     /* figure out where we are */
     char *root;
     if (lslash) {
-      root = gpr_malloc(lslash - me + 1);
+      root = gpr_malloc((size_t)(lslash - me + 1));
       memcpy(root, me, (size_t)(lslash - me));
       root[lslash - me] = 0;
     } else {
-      root = strdup(".");
+      root = gpr_strdup(".");
     }
     gpr_asprintf(&args[0], "%s/../../test/core/httpcli/test_server.py", root);
     gpr_free(root);
diff --git a/test/core/httpcli/httpscli_test.c b/test/core/httpcli/httpscli_test.c
index 4cfa9e59b00ec57f7762632ac38764765e6bbfca..ba5660bd187630ac2a99dffa51cc70afee31931c 100644
--- a/test/core/httpcli/httpscli_test.c
+++ b/test/core/httpcli/httpscli_test.c
@@ -153,11 +153,11 @@ int main(int argc, char **argv) {
     /* figure out where we are */
     char *root;
     if (lslash) {
-      root = gpr_malloc(lslash - me + 1);
+      root = gpr_malloc((size_t)(lslash - me + 1));
       memcpy(root, me, (size_t)(lslash - me));
       root[lslash - me] = 0;
     } else {
-      strcpy(root, ".");
+      root = gpr_strdup(".");
     }
     gpr_asprintf(&args[0], "%s/../../test/core/httpcli/test_server.py", root);
     gpr_free(root);