Page MenuHomeFreeBSD

D61413.1796356155.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D61413.1796356155.diff

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

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)

Event Timeline