Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133600975
D8286.id21503.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D8286.id21503.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D8286: printf: Validate argument index is >0
Attached
Detach File
Event Timeline
Log In to Comment