Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178259687
D61413.1796356155.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D61413.1796356155.diff
View Options
Index: sys/netpfil/pf/pf_table.c
===================================================================
--- sys/netpfil/pf/pf_table.c
+++ sys/netpfil/pf/pf_table.c
@@ -1878,6 +1878,8 @@
size_t siz = MAXPATHLEN;
int i;
+ if (anchor[siz - 1])
+ return (-1);
if (anchor[0] == '/') {
char *path;
int off;
@@ -1889,8 +1891,6 @@
bcopy(path, anchor, siz - off);
memset(anchor + siz - off, 0, off);
}
- if (anchor[siz - 1])
- return (-1);
for (i = strlen(anchor); i < siz; i++)
if (anchor[i])
return (-1);
Index: tests/sys/netpfil/pf/ioctl/validation.c
===================================================================
--- tests/sys/netpfil/pf/ioctl/validation.c
+++ tests/sys/netpfil/pf/ioctl/validation.c
@@ -97,6 +97,13 @@
if (ioctl(dev, DIOCRADDTABLES, &io) == 0)
atf_tc_fail("Request with NULL buffer succeeded");
+ /* Unterminated anchor name */
+ common_init_tbl(&tbl);
+ memset(tbl.pfrt_anchor, '/', sizeof(tbl.pfrt_anchor));
+ io.pfrio_buffer = &tbl;
+ if (ioctl(dev, DIOCRADDTABLES, &io) == 0)
+ atf_tc_fail("Request with unterminated anchor name succeeded");
+
/* This can provoke a memory leak, see r331225. */
io.pfrio_size = 4;
for (int i = 0; i < io.pfrio_size; i++)
@@ -148,6 +155,13 @@
io.pfrio_buffer = NULL;
if (ioctl(dev, DIOCRDELTABLES, &io) == 0)
atf_tc_fail("Request with NULL buffer succeeded");
+
+ /* Unterminated anchor name */
+ common_init_tbl(&tbl);
+ memset(tbl.pfrt_anchor, '/', sizeof(tbl.pfrt_anchor));
+ io.pfrio_buffer = &tbl;
+ if (ioctl(dev, DIOCRDELTABLES, &io) == 0)
+ atf_tc_fail("Request with unterminated anchor name succeeded");
}
ATF_TC_CLEANUP(deltables, tc)
@@ -350,6 +364,13 @@
io.pfrio_buffer = NULL;
if (ioctl(dev, DIOCRSETTFLAGS, &io) != -1)
atf_tc_fail("Request with NULL buffer succeeded");
+
+ /* Unterminated anchor name */
+ memset(tbl.pfrt_anchor, '/', sizeof(tbl.pfrt_anchor));
+ io.pfrio_buffer = &tbl;
+ io.pfrio_size = 1;
+ if (ioctl(dev, DIOCRSETTFLAGS, &io) == 0)
+ atf_tc_fail("Request with unterminated anchor name succeeded");
}
ATF_TC_CLEANUP(settflags, tc)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 4, 3:49 AM (20 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42199859
Default Alt Text
D61413.1796356155.diff (2 KB)
Attached To
Mode
D61413: pf: check anchor termination before stripping slashes
Attached
Detach File
Event Timeline