bugJailkit - Bugs: bug #46320, uid length problem

 
 

bug #46320: uid length problem

Submitter:  Martin Lonkwitz <mawelo>
Submitted:  Thu 29 Oct 2015 09:07:26 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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 Files:
   
   
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
  • -email is unavailable- added by oli4 (Posted a comment)
  • -email is unavailable- added by mawelo (Submitted the item)
  • -email is unavailable- added by mawelo
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-11-04 oli4 StatusNone Fixed
        Open/ClosedOpen Closed
    2015-10-30 mawelo Attached File- Added passwdparser.patch.txt, #35334
    2015-10-29 mawelo Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code