pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid use of non-portable strnlen() in pgstat_clip_activity().
2+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2017-09-19 896537f078  s/NULL byte/NUL byte/ in comment refering to C string terminator.
* pgsql: Avoid use of non-portable strnlen() in pgstat_clip_activity().
@ 2017-09-19 21:27 Andres Freund <andres@anarazel.de>
  2017-09-19 23:18 ` Re: pgsql: Avoid use of non-portable strnlen() in pgstat_clip_activity(). Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Andres Freund @ 2017-09-19 21:27 UTC (permalink / raw)
  To: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/71edbb6f66f7139d6209334ef8734a122ba06b56

Modified Files
--------------
src/backend/postmaster/pgstat.c | 25 +++++++++++++++++++++----
src/include/pgstat.h            |  2 +-
2 files changed, 22 insertions(+), 5 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pgsql: Avoid use of non-portable strnlen() in pgstat_clip_activity().
  2017-09-19 21:27 pgsql: Avoid use of non-portable strnlen() in pgstat_clip_activity(). Andres Freund <andres@anarazel.de>
@ 2017-09-19 23:18 ` Robert Haas <robertmhaas@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Robert Haas @ 2017-09-19 23:18 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers

On Tue, Sep 19, 2017 at 5:27 PM, Andres Freund <andres@anarazel.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


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2017-09-19 23:18 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-09-19 21:27 pgsql: Avoid use of non-portable strnlen() in pgstat_clip_activity(). Andres Freund <andres@anarazel.de>
2017-09-19 23:18 ` Robert Haas <robertmhaas@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox