Page MenuHomeFreeBSD

D8286.id21503.diff
No OneTemporary

D8286.id21503.diff

Index: contrib/netbsd-tests/lib/libc/stdio/t_printf.c
===================================================================
--- contrib/netbsd-tests/lib/libc/stdio/t_printf.c
+++ contrib/netbsd-tests/lib/libc/stdio/t_printf.c
@@ -120,12 +120,6 @@
{
char s[16], fmt[32];
-#ifndef __NetBSD__
- atf_tc_expect_signal(SIGSEGV,
- "some non-NetBSD platforms including FreeBSD don't validate "
- "negative size; testcase blows up with SIGSEGV");
-#endif
-
snprintf(fmt, sizeof(fmt), "%%%zu$d", SIZE_MAX / sizeof(size_t));
ATF_CHECK(snprintf(s, sizeof(s), fmt, -23) == -1);
Index: lib/libc/stdio/printf-pos.c
===================================================================
--- lib/libc/stdio/printf-pos.c
+++ lib/libc/stdio/printf-pos.c
@@ -113,6 +113,13 @@
_ensurespace(struct typetable *types)
{
+ /*
+ * Validate sign first.
+ * nextarg is 1-based argument index.
+ */
+ if (types->nextarg <= 0)
+ return (-1);
+
if (types->nextarg >= types->tablesize) {
if (__grow_type_table(types))
return (-1);

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 27, 11:01 PM (15 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24320904
Default Alt Text
D8286.id21503.diff (1 KB)

Event Timeline