[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coreutils readutmp applies strchr to a non-string
From: |
Paul Eggert |
Subject: |
Re: coreutils readutmp applies strchr to a non-string |
Date: |
Fri, 11 Jun 2004 23:35:16 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
address@hidden (Paul Jarc) writes:
> Paul Eggert <address@hidden> wrote:
>> coreutils readutmp applies strchr to a buffer that is not
>> null-terminated.
>
> Would this work? It seems like the simplest fix.
>
> - p = strchr (trimmed_name, ' ');
> + p = memchr (trimmed_name, ' ', sizeof (UT_USER (ut)) + 1);
Yes, that's a simpler fix, but it still doesn't make the code match
the comments. The comments say 'trim trailing spaces' but the above
code trims non-spaces if they are preceded by a space.