From f826cfc02dd32d09c712f82bb0bd0f20920b628f Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Mon, 16 Sep 2024 08:53:27 -0700 Subject: [PATCH] Use field size instead of relying on null termination in posted content. Closes #180 --- http.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/http.c b/http.c index aa008ed..2c16f95 100644 --- a/http.c +++ b/http.c @@ -1224,7 +1224,8 @@ Datum http_request(PG_FUNCTION_ARGS) CURL_SETOPT(g_http_handle, CURLOPT_CUSTOMREQUEST, "DELETE"); } - CURL_SETOPT(g_http_handle, CURLOPT_POSTFIELDS, text_to_cstring(content_text)); + CURL_SETOPT(g_http_handle, CURLOPT_POSTFIELDS, (char *)(VARDATA(content_text))); + CURL_SETOPT(g_http_handle, CURLOPT_POSTFIELDSIZE, content_size); } else if ( method == HTTP_PUT || method == HTTP_PATCH || method == HTTP_UNKNOWN ) {