Bug 13767 - lprm doesn't work for "long" usernames
Summary: lprm doesn't work for "long" usernames
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: lpr
Version: 6.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-07-12 05:40 UTC by Spruce Moose
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-07-12 06:08:27 UTC
Embargoed:


Attachments (Terms of Use)

Description Spruce Moose 2000-07-12 05:40:13 UTC
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 06:08:25 UTC
Isn't this also a buffer overflow by one character if the username is of length
16?

Comment 2 Bernhard Rosenkraenzer 2000-07-17 11:21:07 UTC
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.