Re: coreutils readutmp applies strchr to a non-string
From:
Jim Meyering
Subject:
Re: coreutils readutmp applies strchr to a non-string
Date:
Sat, 12 Jun 2004 10:11:11 +0200
Paul Eggert <address@hidden> wrote:
> coreutils readutmp applies strchr to a buffer that is not
> null-terminated. This has undefined behavior in C, even if the buffer
> has the char in question. Here's a patch.
>
> 2004-06-11 Paul Eggert <address@hidden>
>
> * readutmp.c (extract_trimmed_name): Don't apply strchr to a
> non-string; this leads to undefined behavior.
Applied. Thanks!
BTW, did you find a system on which the existing code misbehaved?
If so, I'd like to document that.