aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-01-23 15:06:44 -0800
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-01-23 15:06:44 -0800
commit82df7446ae964804fe1d3cb384fc819fdd7aa951 (patch)
treec421e19d2631cc70395037c4e477ef3023a44f53 /test
parent2be952ce28e5797d1f157e2c52ba3f80df8232fc (diff)
Remove use of sprintf
Diffstat (limited to 'test')
-rw-r--r--test/core/security/credentials_test.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c
index ec21e0d42f..1c83cc8059 100644
--- a/test/core/security/credentials_test.c
+++ b/test/core/security/credentials_test.c
@@ -498,10 +498,8 @@ static void validate_service_account_http_request(
char *expected_body = NULL;
GPR_ASSERT(body != NULL);
GPR_ASSERT(body_size != 0);
- expected_body = gpr_malloc(strlen(expected_service_account_http_body_prefix) +
- strlen(test_signed_jwt) + 1);
- sprintf(expected_body, "%s%s", expected_service_account_http_body_prefix,
- test_signed_jwt);
+ gpr_asprintf(&expected_body, "%s%s",
+ expected_service_account_http_body_prefix, test_signed_jwt);
GPR_ASSERT(strlen(expected_body) == body_size);
GPR_ASSERT(!memcmp(expected_body, body, body_size));
gpr_free(expected_body);