Bug 2160647

Summary: tlock: Fix missing prototype for crypt (pointer truncation)
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: tlockAssignee: pjp <pj.pandit>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: pj.pandit
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tlock-1.6-17.fc38 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-01-13 07:48:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2141798    
Attachments:
Description Flags
tlock-c99.patch none

Description Florian Weimer 2023-01-13 07:22:19 UTC
The lock_user function has:

    passwd1 = readpass (PROMPT, DISPLAY, PASS_LEN);    /* read password */
    passwd2 = (char *) crypt (passwd1, salt);
    free (passwd1);
    passwd1 = calloc (strlen (passwd2) + 1, sizeof (char));
    strcpy (passwd1, passwd2);

But crypt is not declared, which means that the return value of crypt is clipped to 32 bits, likely resulting in crashes on 64-bit architectures.

Part of C99 porting. Upstream does not seem to have a bug tracker, so filing it here.

Comment 1 Florian Weimer 2023-01-13 07:35:07 UTC
Created attachment 1937754 [details]
tlock-c99.patch