Hal Murray via devel <devel@ntpsec.org>: > > NetBSD just released version 9.0. It now generates this warning: > > ../../ntpd/ntp_control.c:1476:34: warning: '%s' directive output may be > truncated writing up to 255 bytes into a region of size between 0 and 255 > [-Wformat-truncation=] > > char str[256]; > > snprintf(str, sizeof(str), "%s/%s", utsnamebuf.sysname, > utsnamebuf.release); > > Has anybody seen this before and/or know how to fix it?
I've seen it before. Rarely. If your format string had only a single %s in it, you could fix it by adding a precision specifier to the string (not a length specifier, a *precision* specifier) which bounds the amount of bytes theb snprinf can write into the buffer. I guess you could give both %s-cookies a precision specifier of 128. -- <a href="http://www.catb.org/~esr/">Eric S. Raymond</a> _______________________________________________ devel mailing list devel@ntpsec.org http://lists.ntpsec.org/mailman/listinfo/devel