alpine 3.7
misc weakness #418


Weakness Breakdown


The software specifies permissions for a security-critical resource in a way that allows the resource to be read or modified by unintended actors.

Warning code(s):

Exactly what cuserid.

File Name:



The highlighted line of code below is the trigger point of this particular Alpine 3.7 misc weakness.

        } else {
          /* This is really serious, so just exit. */
          perror("nedit: getpwuid() failed ");
    strncpy(homedir, ptr, sizeof(homedir)-1);
    /* Fix trailing slash */
    if (len>1 && homedir[len-1]=='/') {
    return homedir;

** Return a pointer to the username of the current user in a statically
** allocated string.
const char
#ifdef VMS
    return cuserid(NULL);
    /* cuserid has apparently been dropped from the ansi C standard, and if
       strict ansi compliance is turned on (on Sun anyhow, maybe others), calls
       to cuserid fail to compile.  Older versions of nedit try to use the
       getlogin call first, then if that fails, use getpwuid and getuid.  This
       results in the user-name of the original terminal being used, which is
       not correct when the user uses the su command.  Now, getpwuid only: */

    const struct passwd *passwdEntry;
    static char *userName=NULL;
    if (userName)
       return userName;
    passwdEntry = getpwuid(getuid());
    if (!passwdEntry) {
       /* This is really serious, but sometimes username service
          is misconfigured through no fault of the user.  Be nice
          and let the user start nc anyway. */
       perror("nedit: getpwuid() failed - reverting to $ USER");
       return getenv("USER");
    else {
       strcpy(userName, passwdEntry->pw_name); 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.