-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
out_s3: fix tag corruption with preserve_data_ordering #6988
out_s3: fix tag corruption with preserve_data_ordering #6988
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the flb_calloc
errors.
plugins/out_s3/s3.c
Outdated
@@ -105,7 +105,7 @@ static char *mock_error_response(char *error_env_var) | |||
|
|||
err_val = getenv(error_env_var); | |||
if (err_val != NULL && strlen(err_val) > 0) { | |||
error = flb_malloc(strlen(err_val) + sizeof(char)); | |||
error = flb_calloc(strlen(err_val) + sizeof(char)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flb_calloc
requires 2 paramters : element count and element size
In this case I'd suggest writing flb_calloc(strlen(err_val) + 1, sizeof(char))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed/Thanks!!!!
It is concerning that I
- have known how calloc works in the past
- self-code-reviewed this code to avoid embarrassing mistakes
- didn't catch it
:/
plugins/out_s3/s3.c
Outdated
@@ -158,7 +158,7 @@ int create_headers(struct flb_s3 *ctx, char *body_md5, | |||
return 0; | |||
} | |||
|
|||
s3_headers = flb_malloc(sizeof(struct flb_aws_header) * headers_len); | |||
s3_headers = flb_calloc(sizeof(struct flb_aws_header) * headers_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as 108, use headers_len as element count and the sizeof as element size
I just commented a few of those but there are quite a few. Additionally, I can't really review the string replacement modifications right now, it's too late and my brain is fried so either somebody else reviews it or I'll do it in the morning. |
Signed-off-by: Wesley Pettit <[email protected]>
Signed-off-by: Wesley Pettit <[email protected]>
Signed-off-by: Wesley Pettit <[email protected]>
Signed-off-by: Wesley Pettit <[email protected]>
efeffdd
to
5eab869
Compare
@leonardo-albertovich Sorry/thanks... I have fixed that calloc mistake... :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Looks good to me too, all we are missing right now is a 2.0 backport, will you do it or should we? it'd be good if we merged the three of them at the same time just to keep things tidy |
@leonardo-albertovich Sorry, when you said backport earlier I didn't realize we now have a 2.0 backport branch for 2.0 instead of 2.1. Sorry. |
No worries I've already done it and merged all three of them together, thanks a lot! |
Fixes #6933
Enter
[N/A]
in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-test
label to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.