Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • libslirp libslirp
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 19
    • Issues 19
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

Due to an influx of spam, we have had to impose restrictions on new accounts. Please see this wiki page for instructions on how to get full permissions. Sorry for the inconvenience.

  • slirpslirp
  • libslirplibslirp
  • Merge requests
  • !82

Remove alloca() call in get_dns_addr_resolv_conf()

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Marc-André Lureau requested to merge elmarco/libslirp:master into master May 07, 2021
  • Overview 0
  • Commits 1
  • Pipelines 1
  • Changes 1

The ALLOCA(3) man-page mentions its "use is discouraged".

For now get_dns_addr_resolv_conf() is called with pointer to a in_addr/in6_addr structure, and its size. Declare a union of these structures on the stack, able to hold both of them. This allows us to remove the alloca() call, keeping the buffer on the stack.

Add an assertion in the unlikely case another inet address is handled by this function.

Signed-off-by: Philippe Mathieu-Daudé philmd@redhat.com Message-Id: 20210507133212.1952121-1-philmd@redhat.com

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: master