Re: strncpy is not a safe version of strcpy

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Tomas Vondra <tv(at)fuzzy(dot)cz>, David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: strncpy is not a safe version of strcpy
Date: 2013-11-15 15:01:46
Message-ID: 20131115150146.GB5489@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-11-15 10:04:12 -0500, Stephen Frost wrote:
> * Andres Freund (andres(at)2ndquadrant(dot)com) wrote:
> > Sure, there can be longer paths, but postgres don't support them. In a
> > *myriad* of places. It's just not worth spending code on it.
> >
> > Just about any of the places that use MAXPGPATH are "vulnerable" or
> > produce confusing error messages if it's exceeded. And there are about
> > zero complaints about it.
>
> Confusing error messages are one thing, segfaulting is another.

I didn't argue against s/strncpy/strlcpy/. That's clearly a sensible
fix.
I am arguing about introducing additional code and error messages about
it, that need to be translated. And starting doing so in isolationtester
of all places.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2013-11-15 15:04:12 Re: strncpy is not a safe version of strcpy
Previous Message Rod Taylor 2013-11-15 14:57:16 Re: GIN improvements part2: fast scan