aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/surface
diff options
context:
space:
mode:
authorGravatar Yuchen Zeng <zyc@google.com>2016-06-10 11:19:51 -0700
committerGravatar Yuchen Zeng <zyc@google.com>2016-06-10 11:19:51 -0700
commit64c0e8d4bcf5f6822cdef368ee84074c3ea234c7 (patch)
tree6f16adc57086737989c9367c59964adabbb1438e /src/core/lib/surface
parent1bc2976a0f51e14d3525aecbf4b3450445ed2d1b (diff)
Add format check for gpr_log and gpr_asprintf
Diffstat (limited to 'src/core/lib/surface')
-rw-r--r--src/core/lib/surface/call.c4
-rw-r--r--src/core/lib/surface/call_log_batch.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c
index a9b1e25a77..c613f325dc 100644
--- a/src/core/lib/surface/call.c
+++ b/src/core/lib/surface/call.c
@@ -1182,7 +1182,7 @@ static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx,
if (algo >= GRPC_COMPRESS_ALGORITHMS_COUNT) {
gpr_asprintf(&error_msg, "Invalid compression algorithm value '%d'.",
algo);
- gpr_log(GPR_ERROR, error_msg);
+ gpr_log(GPR_ERROR, "%s", error_msg);
close_with_status(exec_ctx, call, GRPC_STATUS_UNIMPLEMENTED, error_msg);
} else if (grpc_compression_options_is_algorithm_enabled(
&compression_options, algo) == 0) {
@@ -1191,7 +1191,7 @@ static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx,
grpc_compression_algorithm_name(algo, &algo_name);
gpr_asprintf(&error_msg, "Compression algorithm '%s' is disabled.",
algo_name);
- gpr_log(GPR_ERROR, error_msg);
+ gpr_log(GPR_ERROR, "%s", error_msg);
close_with_status(exec_ctx, call, GRPC_STATUS_UNIMPLEMENTED, error_msg);
} else {
call->incoming_compression_algorithm = algo;
diff --git a/src/core/lib/surface/call_log_batch.c b/src/core/lib/surface/call_log_batch.c
index a6d1d5149f..31c074f15d 100644
--- a/src/core/lib/surface/call_log_batch.c
+++ b/src/core/lib/surface/call_log_batch.c
@@ -112,7 +112,7 @@ void grpc_call_log_batch(char *file, int line, gpr_log_severity severity,
size_t i;
for (i = 0; i < nops; i++) {
tmp = grpc_op_string(&ops[i]);
- gpr_log(file, line, severity, "ops[%d]: %s", i, tmp);
+ gpr_log(file, line, severity, "ops[%" PRIuPTR "]: %s", i, tmp);
gpr_free(tmp);
}
}