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

fixed two buffer overflows

This commit is contained in:
Steffen Vogel 2015-09-25 03:16:02 +02:00
parent 876365188c
commit 83e03070a5

View file

@ -1,3 +1,4 @@
/** Node type: OMA Next Generation Services Interface 10 (NGSI) (FIWARE context broker)
*
* This file implements the NGSI context interface. NGSI is RESTful HTTP is specified by
@ -326,10 +327,13 @@ int ngsi_read(struct node *n, struct msg *pool, int poolsize, int first, int cnt
int ngsi_write(struct node *n, struct msg *pool, int poolsize, int first, int cnt)
{
struct ngsi *i = n->ngsi;
struct msg *m = &pool[first];
struct msg *m = &pool[first % poolsize];
if (cnt > 1)
error("NGSI nodes only can send a single message at once");
/* Update context */
for (int j = 0; j < i->context_len; j++) {
for (int j = 0; j < MIN(i->context_len, m->length); j++) {
json_t *attribute = i->context_map[j];
json_t *value = json_object_get(attribute, "value");
json_t *metadatas = json_object_get(attribute, "metadatas");
@ -366,4 +370,4 @@ int ngsi_write(struct node *n, struct msg *pool, int poolsize, int first, int cn
return 1;
}
REGISTER_NODE_TYPE(NGSI, "ngsi", ngsi)
REGISTER_NODE_TYPE(NGSI, "ngsi", ngsi)