[Pkg-phototools-devel] Bug#554494: Bug#554494: pfstools: diff for NMU version 1.8.1-1.1

Guillem Jover guillem at debian.org
Mon Dec 21 09:49:32 UTC 2009


Hi!

On Sun, 2009-12-20 at 20:45:42 +0100, Sebastian Harl wrote:
> On Sun, Dec 20, 2009 at 03:35:07PM +0100, Stefano Zacchiroli wrote:
> > The patch is the one from Ubuntu which has been posted to the bug log
> > a while ago. The rationale of the patch is that in fact that variable
> > is not being used as a "const" char *, hence the declaration should be
> > dropped.
> 
> I still think that the variable is correctly used as a "const char *":
> It's used once as the first argument to strchr(), which, according to
> POSIX, is a "const char *" and once as the only argument to string(),
> which, according to the [C++ reference], accepts a "const char *" as
> well.

That's not the problem, there's two though, strchr returns a pointer
inside the string argument (arguably strchr should have a return type
of ‘const char *’, which would not have allowed this to happen in the
first place), that argument might later on get modified if not NULL, by
setting its contents to the NUL charater, or when it gets passed to
setOptions which takes ‘char *’.

I think ideally getProjection and setOptions would take a ‘const char *’,
and duplicate the string locally if the need to modify it, as one might
want to pass a literal string which would also fail, or might not want
the caller to get stuff modified, but this is not a problem for the
current code base.

regrads,
guillem





More information about the Pkg-phototools-devel mailing list