Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
You need to sign in or sign up before continuing.
  • linux
  • include
  • linux
  • fortify-string.h
Find file BlameHistoryPermalink
  • Kees Cook's avatar
    fortify: Short-circuit known-safe calls to strscpy() · 62e1cbfc
    Kees Cook authored Oct 02, 2022
    
    
    Replacing compile-time safe calls of strcpy()-related functions with
    strscpy() was always calling the full strscpy() logic when a builtin
    would be better. For example:
    
    	char buf[16];
    	strcpy(buf, "yes");
    
    would reduce to __builtin_memcpy(buf, "yes", 4), but not if it was:
    
    	strscpy(buf, yes, sizeof(buf));
    
    Fix this by checking if all sizes are known at compile-time.
    
    Cc: linux-hardening@vger.kernel.org
    Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
    Signed-off-by: default avatarKees Cook <keescook@chromium.org>
    62e1cbfc
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7