Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libwrap



    Date:        Thu, 10 Jan 2019 08:53:27 -0500
    From:        "Christos Zoulas" <christos%netbsd.org@localhost>
    Message-ID:  <20190110135327.189A1FB16%cvs.NetBSD.org@localhost>

  | PR/53851: Andreas Gustafsson: libwrap prints "m" instead of errno
  | Handle %m inline if needed, otherwise vasprintf strips the %m and...

That change handles the simple case of %m but fails on %%m (though
that is, I assume, unlikely, in libwrap error messages).

The simple change, making the test be ...

	if ((ptr = strstr(fmt, "%m")) != NULL &&
	    (ptr == fmt || ptr[-1] != '%'))

fails on %%%m (though I would guess that is even less likely).

There's no good way to correctly fix this using this technique, what
is needed is to do as the syslog() functions do, and actually do a
(restricted) parse of the format string.

For this though, I suspect it would be overkill.   The point of this message
is just to make sure everyone is aware of this, and perhaps, if there is
some suitable place to document it, that that be done.

Oh for the ability to simply add application specific format specifiers
to printf - I think plan9 has something along those lines.   It would be
farily easy to add, if only gcc didn't go and do printf format string
analysis and complain when it sees something it does not understand.

kre



Home | Main Index | Thread Index | Old Index