1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

ngsi: fix use after free in heap

This commit is contained in:
Steffen Vogel 2022-11-23 10:02:51 +01:00
parent 576a63be9c
commit 3bb513282d
2 changed files with 3 additions and 3 deletions

View file

@ -518,7 +518,7 @@ int ngsi_request_context_query(CURL *handle, const char *endpoint, json_t *json_
char *reason;
json_t *json_response;
json_t *json_request = json_pack("{ s: [ o ] }", "entities", json_entity);
json_t *json_request = json_pack("{ s: [ O ] }", "entities", json_entity);
ret = ngsi_request(handle, endpoint, "queryContext", json_request, &json_response, logger);
if (ret) {
@ -543,7 +543,7 @@ int ngsi_request_context_update(CURL *handle, const char *endpoint, const char *
char *reason;
json_t *json_response;
json_t *json_request = json_pack("{ s: s, s: [ o ] }",
json_t *json_request = json_pack("{ s: s, s: [ O ] }",
"updateAction", action,
"contextElements", json_entity
);

View file

@ -25,7 +25,7 @@ using namespace villas::utils;
char * villas::node::socket_print_addr(struct sockaddr *saddr)
{
union sockaddr_union *sa = (union sockaddr_union *) saddr;
char *buf = new char[256];
auto *buf = reinterpret_cast<char *>(::malloc(256));
if (!buf)
throw MemoryAllocationError();