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

net: context: connect: Make sure local end is bound before connecting #817

Merged
merged 1 commit into from Jul 17, 2017

Conversation

pfalcon
Copy link
Contributor

@pfalcon pfalcon commented Jul 17, 2017

Introduce net_context_bind_default() to ensure that local address is
set for context if not yet (via explict bind() call). This fixes
dereferences of NULL pointer to local address which was exposed when
MMU was enabled for qemu_x86.

Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org

@pfalcon
Copy link
Contributor Author

pfalcon commented Jul 17, 2017

This version supersedes #785

Copy link
Member

@jukkar jukkar left a comment

Choose a reason for hiding this comment

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

LGTM, very minor nit pick

/* If local address is not bound, bind it to INADDR_ANY and random port. */
static int bind_default(struct net_context *context)
{
sa_family_t af = net_context_get_family(context);
Copy link
Member

Choose a reason for hiding this comment

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

Would prefer "family" instead of "af", as the family variable is used in other part of the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@jukkar jukkar added the net label Jul 17, 2017
Introduce net_context_bind_default() to ensure that local address is
set for context if not yet (via explict bind() call). This fixes
dereferences of NULL pointer to local address which was exposed when
MMU was enabled for qemu_x86.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
@jukkar jukkar merged commit 9ed716b into zephyrproject-rtos:master Jul 17, 2017
nagineni pushed a commit to nagineni/zephyr that referenced this pull request Nov 20, 2017
…rproject-rtos#817)

The new ZJS_VALIDATE_ARGS macro and related macros are to be used at
the top of any JerryScript C binding to verify the quantity and types
of arguments, and return standard exceptions if there is a problem.

The comments above the macros in zjs_util.h explain the details of how
they are to be used.

Signed-off-by: Geoff Gustafson <geoff@linux.intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants