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

IPv6 support issue in flb_hs_create #9423

Open
ryanlyy opened this issue Sep 26, 2024 · 1 comment · May be fixed by #9449
Open

IPv6 support issue in flb_hs_create #9423

ryanlyy opened this issue Sep 26, 2024 · 1 comment · May be fixed by #9449
Labels

Comments

@ryanlyy
Copy link

ryanlyy commented Sep 26, 2024

In below code, tmp length is 32. but if ipv6 address is like: 1234:5678:1234:5678:1234:5678:1234:5678. and if port is 33333. then the total length of listen address is: 32 + 7 + 5 = 44. But the buff tmp is only 32 bytes. so there will be memory issue.

/* Create ROOT endpoints */
struct flb_hs *flb_hs_create(const char *listen, const char *tcp_port,
struct flb_config *config)
{
int vid;
char tmp[32];

/* Compose listen address */
snprintf(tmp, sizeof(tmp) -1, "%s:%s", listen, tcp_port);
@niedbalski
Copy link
Collaborator

I confirm this issue. To my understanding v6 addresses can be up to 39 characters long (1234:5678:1234:5678:1234:5678:1234:5678 is a valid example), and ports can be up to 5 characters long (65535). Also, we need to account for the colon (:) between the address and port. Thus, the maximum length would be: 39 (IPv6 address) + 1 (colon) + 5 (port) = 45.

For context should refer to this RFC 4291 -- My understanding is that this affects http server (

#ifdef FLB_HAVE_HTTP_SERVER
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants