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

[TA1487] Passing correct size to getnameinfo() #77

Merged
merged 3 commits into from
Jul 2, 2018
Merged
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions lib/libzrepl/data_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,9 @@ uzfs_zvol_io_conn_acceptor(void *arg)
#ifdef DEBUG
hbuf = kmem_alloc(sizeof (NI_MAXHOST), KM_SLEEP);
sbuf = kmem_alloc(sizeof (NI_MAXSERV), KM_SLEEP);
rc = getnameinfo(&in_addr, in_len, hbuf, sizeof (hbuf),
sbuf, sizeof (sbuf), NI_NUMERICHOST |
NI_NUMERICSERV);
rc = getnameinfo(&in_addr, in_len, hbuf,
sizeof (NI_MAXHOST), sbuf, sizeof (NI_MAXSERV),
NI_NUMERICHOST | NI_NUMERICSERV);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to remove sizeof in front of NI_MAXHOST and NI_MAXSERV and the same for kmem_allocs above. Those are integers and not C types.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ! Fixed this issue. Please have a look.

if (rc == 0) {
LOG_DEBUG("Accepted connection from %s:%s",
hbuf, sbuf);
Expand Down