[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#229785: sessreg: session overwritten can be due to ut_id 4 byte length limit



tag 229785 + help
thanks

On Wed, Jan 28, 2004 at 05:12:17PM -0300, Margarita Manterola wrote:
> Package: xutils
> Version: 4.2.1-12.1
> Severity: normal
> Followup-For: Bug #229785
> 
> Hi!
> 
> I've been investigating a little bit more about this bug and I've found
> some extra information.
> 
> In sessreg.c, lines 371 - 385:
> -*-*-*-*-*-
>         if (line) {
>                 int     i;
>                 /*
>                  * this is a bit crufty, but
>                  * follows the apparent conventions in
>                  * the ttys file.  ut_id is only 4 bytes
>                  * long, and the last 4 bytes of the line
>                  * name are written into it, left justified.
>                  */
>                 i = strlen (line);
>                 if (i >= sizeof (u->ut_id))
>                         i -= sizeof (u->ut_id);
>                 else
>                         i = 0;
>                 (void) strncpy (u->ut_id, line + i, sizeof (u->ut_id));
> -*-*-*-*-*-
> 
> The thing is that if you have different host names, with the same 
> display numbers, such as "test:0" and "fist:0", this is keeping only
> the last 4 characters of the name, and will consider that these two
> hosts are in fact only one host.
> 
> I think that doing a hash, or something like that would be better.
> 
> Hope it helps solve this bug.

Yes; thank you very much for tracking this down.  Fast work!

I do not think I will have time to address this bug myself in the short
term, so I am tagging it "help".

-- 
G. Branden Robinson                |     You could wire up a dead rat to a
Debian GNU/Linux                   |     DIMM socket and the PC BIOS memory
branden@debian.org                 |     test would pass it just fine.
http://people.debian.org/~branden/ |     -- Ethan Benson

Attachment: signature.asc
Description: Digital signature


Reply to: