Skip to content

Commit b3d8b40

Browse files
pwhelanedsiper
authored andcommitted
in_calyptia_fleet: fix use after free and non-null terminated string.
Signed-off-by: Phillip Whelan <[email protected]>
1 parent 97ad4eb commit b3d8b40

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

plugins/in_calyptia_fleet/in_calyptia_fleet.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ static flb_sds_t parse_api_key_json(struct flb_in_calyptia_fleet_config *ctx,
379379
msgpack_unpacked result;
380380
msgpack_object_kv *cur;
381381
msgpack_object_str *key;
382+
flb_sds_t project_id;
382383
int i = 0;
383384

384385
/* Initialize packer */
@@ -415,9 +416,11 @@ static flb_sds_t parse_api_key_json(struct flb_in_calyptia_fleet_config *ctx,
415416
msgpack_unpacked_destroy(&result);
416417
return NULL;
417418
}
419+
project_id = flb_sds_create_len(cur->val.via.str.ptr,
420+
cur->val.via.str.size);
418421
msgpack_unpacked_destroy(&result);
419422
flb_free(pack);
420-
return flb_sds_create(cur->val.via.str.ptr);
423+
return project_id;
421424
}
422425
}
423426
}

0 commit comments

Comments
 (0)