Page MenuHomeFreeBSD

D51433.id158813.diff
No OneTemporary

D51433.id158813.diff

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -284,19 +284,32 @@
return (0);
}
- /*
- * If there's no end pointer then the buffer is coming from
- * the kenv and we know it's null-terminated.
- */
- if (end == NULL)
+ /* Ensure that strtoq() won't walk off the end */
+ if (end == NULL) {
+ /*
+ * If there's no end pointer then the buffer is coming from
+ * the kenv and we know it's null-terminated.
+ */
end = *list + strlen(*list);
+ } else {
+ /*
+ * If there is and end pointer then the buffer is not null-
+ * terminated. The pointer is after the end of the buffer, so
+ * we need to change the last char inside the buffer to \0 if
+ * we can.
+ */
+ end--;
- /* Ensure that strtoq() won't walk off the end */
- if (*end != '\0') {
- if (*end == '\n' || *end == ' ' || *end == ',')
+ switch (*end) {
+ case '\n':
+ case ' ':
+ case ',':
*end = '\0';
- else {
- printf("Blacklist not terminated, skipping\n");
+ /* FALLTHROUGH */
+ case '\0':
+ break;
+ default:
+ printf("Blacklist not terminated by '\\n', ' ' or ',', skipping\n");
*list = NULL;
return (0);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 11, 10:04 PM (14 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26877583
Default Alt Text
D51433.id158813.diff (1 KB)

Event Timeline