On Wed, 29 Dec 2010, Alan Barrett wrote:
On Tue, 28 Dec 2010, Christos Zoulas wrote:
Modified Files:
src/tests/lib/libc/ssp: h_vsnprintf.c h_vsprintf.c
-static void
-wrap(char *str, size_t len, const char *fmt, ...)
+void
+wrap(size_t len, const char *fmt, ...)
{
+ char b[10];
va_list ap;
va_start(ap, fmt);
- (void)vsnprintf(str, len, fmt, ap);
+ (void)vsnprintf(b, len, fmt, ap);
+ (void)printf("%s\n", b);
va_end(ap);
}
I don't know where "len" comes from, but bad things will happen if
len > sizeof(b).
And that's exactly the point. We're testing that ssp actually notices
that "bad things will happen" and trigges a SIGABRT rather than letting
the program proceed.
-------------------------------------------------------------------------
| Paul Goyette | PGP Key fingerprint: | E-mail addresses: |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer | | pgoyette at netbsd.org |
-------------------------------------------------------------------------