Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • xserver xserver
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 922
    • Issues 922
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 119
    • Merge requests 119
  • 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
  • xorgxorg
  • xserverxserver
  • Merge requests
  • !570

xkb: Fix heap overflow caused by optimized away min.

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Matt Turner requested to merge mattst88/xserver:xkb-ub-fix into master Dec 04, 2020
  • Overview 1
  • Commits 1
  • Pipelines 1
  • Changes 1

Calling strlen on char[4] that does not need to contain '\0' is wrong and X server may end up running into uninitialized memory.

In addition GCC 8 is clever enough that it knows that strlen on char[4] can return 0, 1, 2, 3 or cause undefined behavior. With this knowledge it can optimize away the min(..., 4). In reality it can cause the memcpy to be called with bigger size than 4 and overflow the destination buffer.

Fixes: 83913de2 (xkb: Silence some compiler warnings) Closes: #288 (closed) Signed-off-by: Matt Turner mattst88@gmail.com

cc: @ajax

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: xkb-ub-fix