Update validate_user_pointer to check if the ptr is mapped to a physical memory address, w/ E
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "threads/interrupt.h"
|
||||
#include "threads/thread.h"
|
||||
#include "userprog/process.h"
|
||||
#include "userprog/pagedir.h"
|
||||
#include <stdio.h>
|
||||
#include <syscall-nr.h>
|
||||
|
||||
@@ -227,8 +228,9 @@ validate_user_pointer (const void *ptr, size_t size)
|
||||
{
|
||||
if (size > 0 && (ptr == NULL ||
|
||||
!is_user_vaddr (ptr) ||
|
||||
!is_user_vaddr (ptr + size - 1)))
|
||||
!is_user_vaddr (ptr + size - 1) ||
|
||||
pagedir_get_page (thread_current()->pagedir, ptr) == NULL))
|
||||
thread_exit ();
|
||||
|
||||
return ptr;
|
||||
return (void *) ptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user