Skip to content
Snippets Groups Projects
Commit 0ce25e94 authored by ja3-saxby's avatar ja3-saxby
Browse files

Merge branch 'josh/fix-write-bug' into 'master'

Fix a nasty bug in write(). DOn't allow writing to the keyboard!

See merge request !23
parents cbc9aef2 99938681
No related branches found
No related tags found
1 merge request!23Fix a nasty bug in write(). DOn't allow writing to the keyboard!
......@@ -21,7 +21,10 @@ void syscall_write(struct intr_frame *f) {
unsigned size = *((unsigned*)((int*)f->esp + 3)); // size to write is fourth
// writing to stdout or stderr (fd in {1, 2}) is a special case
switch (fd) {
case 1: // stdin
case 0: // writing to stdin (keyboard) is an error condition
f->eax = 0;
break;
case 1: // stdout
case 2: // stderr
write_to_console((const char*)buffer, size);
f->eax = size;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment