Re: pgsql: Avoid use of non-portable strnlen() in pgstat_clip_activity().

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Avoid use of non-portable strnlen() in pgstat_clip_activity().
Date: 2017-09-19 23:18:18
Message-ID: CA+Tgmoa+YBvWgFST2NVoeXjVSohEpK=vqnVCsoCkhTVVxfLcVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Tue, Sep 19, 2017 at 5:27 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> Avoid use of non-portable strnlen() in pgstat_clip_activity().
>
> The use of strnlen rather than strlen was just paranoia. Instead of
> giving up on the paranoia, just implement the safeguard
> differently. And add a comment explaining why we're careful.
>
> Author: Andres Freund
> Discussion: https://postgr.es/m/E1duOkJ-0001Mc-U5@gemulon.postgresql.org

I think it should say a NUL byte or a \0 byte, not a NULL byte. NULL
is a pointer value.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2017-09-19 23:46:13 pgsql: s/NULL byte/NUL byte/ in comment refering to C string terminator
Previous Message Andres Freund 2017-09-19 23:16:50 Re: pgsql: Make new crash restart test a bit more robust.