pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Magnus Hagander <magnus@hagander.net>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: PostgreSQL-documentation <pgsql-docs@postgresql.org>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] Moving tablespaces
Date: Tue, 06 Dec 2011 11:07:56 -0500
Message-ID: <21564.1323187676@sss.pgh.pa.us> (raw)
In-Reply-To: <CABUevExQ=rFLxYXaivKR1ue_yv4BAuNy6z8fDn_3zqa3coZiFQ@mail.gmail.com>
References: <CABUevEx2xYV==WRxWdMr=mS3Q1orBUvJcXa8AZx_LVbL122g5Q@mail.gmail.com>
	<201112041612.pB4GCHt06225@momjian.us>
	<CABUevEzuRQLddyY2yypiZpjWzzEzz0p66TgzoXGuz+jLxKgdkg@mail.gmail.com>
	<23636.1323016890@sss.pgh.pa.us>
	<4EDBA60D.2050904@dunslane.net>
	<26148.1323018451@sss.pgh.pa.us>
	<CABUevEyP-20VSpgBP9J16=vk9-fxj8O6KPr63r9jQxHoca9JeA@mail.gmail.com>
	<19894.1323184352@sss.pgh.pa.us>
	<CABUevEy9MurQp23B0Z7r3jqDoW4N4BHPwnTgiNqNFY3jAJbFEg@mail.gmail.com>
	<20005.1323184633@sss.pgh.pa.us>
	<CABUevExQ=rFLxYXaivKR1ue_yv4BAuNy6z8fDn_3zqa3coZiFQ@mail.gmail.com>

Magnus Hagander <magnus@hagander.net> writes:
> There is some nice precedent in the CREATE TABLESPACE command (though
> dependent on HAVE_SYMLINK and not HAVE_READLINK), so I'm just going to
> copy the error message from there.

Fair enough.

Looking at the existing readlink use in port/exec.c, it strikes me that
another thing you'd better do is include a check for buffer overrun,
ie the test needs to be more like

		rllen = readlink(fname, link_buf, sizeof(link_buf));
		if (rllen < 0 || rllen >= sizeof(link_buf))
			... fail ...

Also, you're assuming that the result is already null-terminated,
which is incorrect.

			regards, tom lane



view thread (17+ messages)  latest in thread

Message-ID: <21564.1323187676@sss.pgh.pa.us>
Permalink:  ../21564.1323187676@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21564.1323187676@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, magnus@hagander.net, andrew@dunslane.net, bruce@momjian.us, pgsql-hackers@postgresql.org
  Subject: Re: [HACKERS] Moving tablespaces
  In-Reply-To: <21564.1323187676@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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