bugJailkit - Bugs: bug #46320, uid length problem

 
 

bug #46320: uid length problem

Submitted by:  Martin Lonkwitz <mawelo>
Submitted on:  Thu 29 Oct 2015 09:07:26 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 04 Nov 2015 09:34:41 PM UTC, comment #1:

I've improved the patch a little, but you are right, uid_t is unsigned int so it can be 11 characters.

snprintf does include the \0 so this is not the problem.

in cvs

Olivier Sessink <oli4>
Project Administrator
Thu 29 Oct 2015 09:07:26 AM UTC, original submission:

Dear all,

I found this problem using NIS on Linux with big UID-values.

file: passwdparser.c
function: struct passwd internal_getpwuid(const char filename, uid_t uid)

"char find" works with a char array fixed length set to 10 but forgot to include the '\0' byte.
So here my suggestion to fix this:

struct passwd internal_getpwuid(const char filename, uid_t uid) {
static struct passwd retpw;
char find[11], *line; // 10 bytes plus 1 byte for \0
memset(find,0,11); // filled with 0 byte
snprintf(find,11,"%d",(int)uid);

It's not 100% okay cause we assume to have a 32 bit integer here....so there is maybe the need for a much better solution.

Best Regards,
Martin

Martin Lonkwitz <mawelo>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #35334:  passwdparser.patch.txt added by mawelo (717B - text/plain - patch file)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by oli4 (Posted a comment)
  • -unavailable- added by mawelo (Submitted the item)
  • -unavailable- added by mawelo
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 04 Nov 2015 09:34:41 PM UTColi4StatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Fri 30 Oct 2015 09:45:11 AM UTCmaweloAttached File-=>Added passwdparser.patch.txt, #35334
    Thu 29 Oct 2015 09:07:26 AM UTCmaweloCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1