diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-01-23 15:17:07 -0800 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-01-23 15:17:07 -0800 |
commit | 28214ea1b24a374335a2a36691cb5d14e1234938 (patch) | |
tree | cd313372197c0c4d2984c457b0955b99c931f459 | |
parent | 9bb2632309310037d9d3af858f1537c4da593fde (diff) |
Remove uses of sprintf
-rw-r--r-- | test/core/transport/chttp2/stream_encoder_test.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/test/core/transport/chttp2/stream_encoder_test.c b/test/core/transport/chttp2/stream_encoder_test.c index eb0f688f58..5e8ec0a1af 100644 --- a/test/core/transport/chttp2/stream_encoder_test.c +++ b/test/core/transport/chttp2/stream_encoder_test.c @@ -186,7 +186,7 @@ static void encode_int_to_str(int i, char *p) { static void test_decode_table_overflow(void) { int i; char key[3], value[3]; - char expect[128]; + char *expect; for (i = 0; i < 114; i++) { if (i > 0) { @@ -197,18 +197,21 @@ static void test_decode_table_overflow(void) { encode_int_to_str(i + 1, value); if (i + 61 >= 127) { - sprintf(expect, "000009 0104 deadbeef ff%02x 40 02%02x%02x 02%02x%02x", - i + 61 - 127, key[0], key[1], value[0], value[1]); + gpr_asprintf(&expect, + "000009 0104 deadbeef ff%02x 40 02%02x%02x 02%02x%02x", + i + 61 - 127, key[0], key[1], value[0], value[1]); } else if (i > 0) { - sprintf(expect, "000008 0104 deadbeef %02x 40 02%02x%02x 02%02x%02x", - 0x80 + 61 + i, key[0], key[1], value[0], value[1]); + gpr_asprintf(&expect, + "000008 0104 deadbeef %02x 40 02%02x%02x 02%02x%02x", + 0x80 + 61 + i, key[0], key[1], value[0], value[1]); } else { - sprintf(expect, "000007 0104 deadbeef 40 02%02x%02x 02%02x%02x", key[0], - key[1], value[0], value[1]); + gpr_asprintf(&expect, "000007 0104 deadbeef 40 02%02x%02x 02%02x%02x", + key[0], key[1], value[0], value[1]); } add_sopb_header(key, value); verify_sopb(0, 0, 0, expect); + gpr_free(expect); } /* if the above passes, then we must have just knocked this pair out of the |