Bug 13767 - lprm doesn't work for "long" usernames
lprm doesn't work for "long" usernames
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: lpr (Show other bugs)
6.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-07-12 01:40 EDT by Spruce Moose
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-07-12 02:08:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Spruce Moose 2000-07-12 01:40:13 EDT
lprm has an arbitrary limit on the length of the username that can remove
jobs.  

From lprm.c:

static char     luser[16];      /* buffer for person */

void    usage();

int
main(argc, argv)
        int argc;
        char *argv[];
{
        register char *arg;
        struct passwd *p;
        
        uid = getuid();
        euid = geteuid();
        seteuid(uid);
        name = argv[0];
        gethostname(host, sizeof(host));
        host[MAXHOSTNAMELEN-1]='\0';
        openlog("lpd", 0, LOG_LPR);
        if ((p = getpwuid(getuid())) == NULL)
                fatal("Who are you?");
        if (strlen(p->pw_name) >= sizeof(luser))
                fatal("Your name is too long");

[...]

The value of 16 is interesting - why not 9?
Comment 1 Spruce Moose 2000-07-12 02:08:25 EDT
Isn't this also a buffer overflow by one character if the username is of length
16?
Comment 2 Bernhard Rosenkraenzer 2000-07-17 07:21:07 EDT
This is fixed by the move to LPRng in rawhide.

Note You need to log in before you can comment on or make changes to this bug.