warning spew from cddl libnvpair.c

Daniel Hartmeier daniel at benzedrine.cx
Fri Oct 25 12:53:12 UTC 2013


How is that valid?

If nvprt_btwnarrfmt contains %, how would

	(void) fprintf(fp, pctl->nvprt_btwnarrfmt); \

not crash?

And if it may not contain %, why not use

	(void) fprintf(fp, "%s", pctl->nvprt_btwnarrfmt); \

It can be set to arbitrary values with

  libnvpair.c nvlist_prtctl_setfmt()

That's exactly why the compiler warns, no?

If anything in the macro/preprocessor trickery is relevant, I'm not
seeing it.

Daniel


More information about the freebsd-hackers mailing list