In request and response buckets, replace usages of sprintf
* buckets/request_buckets.c
(serialize_data): change to snprintf
* buckets/response_buckets.c
(serf_bucket_outgoing_response_prepare,
serialize_outgoing_response): same
git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1717352 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/buckets/request_buckets.c b/buckets/request_buckets.c
index e77badd..7764ed1 100644
--- a/buckets/request_buckets.c
+++ b/buckets/request_buckets.c
@@ -144,7 +144,7 @@
use chunked encoding for the request. */
if (ctx->len != LENGTH_UNKNOWN) {
char buf[30];
- sprintf(buf, "%" APR_INT64_T_FMT, ctx->len);
+ snprintf(buf, 30, "%" APR_INT64_T_FMT, ctx->len);
serf_bucket_headers_set(ctx->headers, "Content-Length", buf);
if (ctx->body != NULL)
serf_bucket_aggregate_append(bucket, ctx->body);
diff --git a/buckets/response_buckets.c b/buckets/response_buckets.c
index 0640f12..e0f63ac 100644
--- a/buckets/response_buckets.c
+++ b/buckets/response_buckets.c
@@ -852,7 +852,7 @@
(assuming this method is called for HTTP2) */
if (content_length != SERF_LENGTH_UNKNOWN) {
char buf[30];
- sprintf(buf, "%" APR_INT64_T_FMT, content_length);
+ snprintf(buf, 30, "%" APR_INT64_T_FMT, content_length);
serf_bucket_headers_setc(ctx->headers, "Content-Length", buf);
}
@@ -884,7 +884,7 @@
char start[32];
struct iovec status_vecs[3];
- sprintf(start, "HTTP/%d.%d %03d ",
+ snprintf(start, 32, "HTTP/%d.%d %03d ",
SERF_HTTP_VERSION_MAJOR(ctx->http_version),
SERF_HTTP_VERSION_MINOR(ctx->http_version),
ctx->status);