Re: 2.1.80 miscellanea

Jim Bourne (jbourne@island.net)
Wed, 21 Jan 1998 14:11:02 -0800 (PST)


On Wed, 21 Jan 1998, Michael Elizabeth Chastain wrote:

> The new code fails to null-terminate the strings if the strings
> are too long (this is better than the old code though!) I think
> you need these lines:
>
> info.id[sizeof(info.id)-1] = '\0';
>
> indo.name[sizeof(info.name)-1] = '\0';

Hi,
Correct me if I'm wrong, but what if the size of a char is *not* one byte as
Linux is ported to more hardware platforms then any other OS that I know of.

Should these not be
...
info.id[(sizeof(info.id)-1) * sizeof(char)] = '\0';
...

Just thought it might be more portable this way.

Regards,
James Bourne

> Michael Chastain
> <mailto:mec@shout.net>
> "love without fear"

--
James Bourne           |            E-Mail:             jbourne@island.net
System Administrator   |            WWW:             http://www.island.net
Island Internet Inc.   |            Linux - The choice of a GNU generation