fedora 23
misc weakness #249

4

Weakness Breakdown


Definition:

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):

This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data.

File Name:

389-ds-base-1.3.4.14/ldap/servers/slapd/tools/ldaptool-sasl.c

Context:

The highlighted line of code below is the trigger point of this particular Fedora 23 misc weakness.

         if(tcsetattr(fileno(stdin), TCSANOW, &termstat) < 0) {
            perror( "tcsetattr" );
            exit( LDAP_LOCAL_ERROR );
        }
    }
    if (fgets(pbuf,256,stdin) == NULL) {
        pass = NULL;
    } else {
        char *tmp;
        pass = NULL;
        tmp = strchr(pbuf,'\n');
        if (tmp)
            *tmp = '\0';
        pass = strdup(pbuf);
    }
    if(havetty) {
        termstat.c_lflag = savestat;
        if(tcsetattr(fileno(stdin), TCSANOW, &termstat) < 0) {
            perror( "tcgetattr" );
            exit( LDAP_LOCAL_ERROR );
        }
    }
#else
    /* limited to 16 chars on Tru64, 32 on AIX */
    pass = (char *)getpass(prompt);
#endif
#endif

    return pass;
} 

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.