File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -240,7 +240,7 @@ Datum protobuf_to_json_text(PG_FUNCTION_ARGS) {
240
240
bytea* result =
241
241
static_cast <bytea*>(palloc0_or_throw_bad_alloc (result_size));
242
242
SET_VARSIZE (result, result_size);
243
- memcpy (VARDATA (result), json_str.data (), result_size );
243
+ memcpy (VARDATA (result), json_str.data (), json_str. size () );
244
244
PG_RETURN_TEXT_P (result);
245
245
} catch (const std::bad_alloc& e) {
246
246
ereport (ERROR, (errcode (ERRCODE_OUT_OF_MEMORY), errmsg (" out of memory" )));
@@ -275,7 +275,7 @@ Datum protobuf_from_json_text(PG_FUNCTION_ARGS) {
275
275
bytea* result =
276
276
static_cast <bytea*>(palloc0_or_throw_bad_alloc (result_size));
277
277
SET_VARSIZE (result, result_size);
278
- memcpy (VARDATA (result), proto_str.data (), result_size );
278
+ memcpy (VARDATA (result), proto_str.data (), proto_str. size () );
279
279
PG_RETURN_BYTEA_P (result);
280
280
} catch (const std::bad_alloc& e) {
281
281
ereport (ERROR, (errcode (ERRCODE_OUT_OF_MEMORY), errmsg (" out of memory" )));
You can’t perform that action at this time.
0 commit comments