Misc Getlogin

The `getlogin` function suffers from many bugs or unknown behaviors depending on the system. Often, it gives only the first 8 characters of the login name. The user currently logged in on the controlling TTY of our program does not necessarily mean it is the user who started the process. Use getpwuid(geteuid()) and extract the desired information instead. Fo

IndexedPublic repositoryHighMedium confidenceVerifiedGPL-2.0-onlyC
greprules fetch gitlab-sast-c-misc-rule-getlogin --engine opengrep

Description

The `getlogin` function suffers from many bugs or unknown behaviors depending on the system. Often, it gives only the first 8 characters of the login name. The user currently logged in on the controlling TTY of our program does not necessarily mean it is the user who started the process. Use getpwuid(geteuid()) and extract the desired information instead. Fo