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
  • linux
  • drivers
  • usb
  • gadget
  • function
  • f_printer.c
Find file BlameHistoryPermalink
  • Azeem Shaikh's avatar
    usb: gadget: function: printer: Replace strlcpy with strscpy · ee400a1b
    Azeem Shaikh authored Jun 15, 2023
    strlcpy() reads the entire source buffer first.
    This read may exceed the destination size limit.
    This is both inefficient and can lead to linear read
    overflows if a source string is not NUL-terminated [1].
    In an effort to remove strlcpy() completely [2], replace
    strlcpy() here with strscpy().
    
    Direct replacement is safe here since return value of -errno
    is used to check for truncation instead of PAGE_SIZE.
    
    [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
    [2] https://github.com/KSPP/linux/issues/89
    
    
    
    Signed-off-by: default avatarAzeem Shaikh <azeemshaikh38@gmail.com>
    Link: https://lore.kernel.org/r/20230615180318.400639-1-azeemshaikh38@gmail.com
    
    
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    ee400a1b
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7