Skip to content

Commit f6a4d39

Browse files
committed
Merge branch 'master' of github.com:fluent/fluent-bit
2 parents 8ca11d2 + d1bcfa8 commit f6a4d39

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

plugins/out_cloudwatch_logs/cloudwatch_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static int write_event(struct flb_cloudwatch *ctx, struct cw_flush *buf,
248248
{
249249
char ts[50];
250250

251-
if (!sprintf(ts, "%llu", event->timestamp)) {
251+
if (!snprintf(ts, 50, "%llu", event->timestamp)) {
252252
goto error;
253253
}
254254

plugins/out_stackdriver/stackdriver_http_request.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,23 @@ void add_http_request_field(struct http_request_field *http_request,
185185
/* latency should be in the format:
186186
* whitespace (opt.) + integer + point & decimal (opt.)
187187
* + whitespace (opt.) + "s" + whitespace (opt.)
188+
*
189+
* latency is Duration, so the maximum value is "315576000000.999999999s".
190+
* (23 characters in length)
188191
*/
189192
static void validate_latency(msgpack_object_str latency_in_payload,
190193
struct http_request_field *http_request) {
191194
flb_sds_t pattern = flb_sds_create("^\\s*\\d+(.\\d+)?\\s*s\\s*$");
192-
char extract_latency[latency_in_payload.size];
195+
char extract_latency[32];
193196
struct flb_regex *regex;
194197

195198
int status = 0;
196199
int i = 0, j = 0;
197200

201+
if (latency_in_payload.size > sizeof(extract_latency)) {
202+
return;
203+
}
204+
198205
regex = flb_regex_create(pattern);
199206
status = flb_regex_match(regex, latency_in_payload.ptr, latency_in_payload.size);
200207
flb_regex_destroy(regex);

src/flb_ra_key.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ static int ra_key_val_id(flb_sds_t ckey, msgpack_object map)
7878
int map_size;
7979
msgpack_object key;
8080

81+
if (map.type != MSGPACK_OBJECT_MAP) {
82+
return -1;
83+
}
84+
8185
map_size = map.via.map.size;
8286
for (i = 0; i < map_size; i++) {
8387
key = map.via.map.ptr[i].key;

src/record_accessor/flb_ra_parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,12 @@ struct flb_ra_parser *flb_ra_parser_string_create(char *str, int len)
224224
flb_ra_parser_destroy(rp);
225225
return NULL;
226226
}
227+
rp->key->subkeys = NULL;
227228
rp->key->name = flb_sds_create_len(str, len);
228229
if (!rp->key->name) {
229230
flb_ra_parser_destroy(rp);
230231
return NULL;
231232
}
232-
rp->key->subkeys = NULL;
233233

234234
return rp;
235235
}

0 commit comments

Comments
 (0)