Skip to content
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

core: fix configuration type cast issue on big endian systems #8904

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/flb_config_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ int flb_config_map_set(struct mk_list *properties, struct mk_list *map, void *co
int ret;
int len;
char *base;
char *m_bool;
int *m_bool;
int *m_i_num;
double *m_d_num;
size_t *m_s_num;
Expand Down Expand Up @@ -651,10 +651,10 @@ int flb_config_map_set(struct mk_list *properties, struct mk_list *map, void *co
}
else if (m->type == FLB_CONFIG_MAP_TIME) {
m_i_num = (int *) (base + m->offset);
*m_i_num = m->value.val.s_num;
*m_i_num = m->value.val.i_num;
}
else if (m->type == FLB_CONFIG_MAP_BOOL) {
m_bool = (char *) (base + m->offset);
m_bool = (int *) (base + m->offset);
*m_bool = m->value.val.boolean;
}
else if (m->type >= FLB_CONFIG_MAP_CLIST ||
Expand Down Expand Up @@ -779,7 +779,7 @@ int flb_config_map_set(struct mk_list *properties, struct mk_list *map, void *co
*m_d_num = atof(kv->val);
}
else if (m->type == FLB_CONFIG_MAP_BOOL) {
m_bool = (char *) (base + m->offset);
m_bool = (int *) (base + m->offset);
leonardo-albertovich marked this conversation as resolved.
Show resolved Hide resolved
ret = flb_utils_bool(kv->val);
if (ret == -1) {
flb_error("[config map] invalid value for boolean property '%s=%s'",
Expand Down
2 changes: 1 addition & 1 deletion tests/internal/config_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct context {
/* Single values */
int num_int;
size_t size;
time_t time;
int time;
int boolean;
double num_double;
flb_sds_t string;
Expand Down
Loading