[shell] Fix a potential null-pointer derefence because we didn't check that cmd wasn't null
This commit is contained in:
parent
cdd9aaab7c
commit
c3395de72f
@ -249,6 +249,10 @@ page_fault(
|
||||
int reserved = r->err_code & 0x8;
|
||||
int id = r->err_code & 0x10;
|
||||
|
||||
if (faulting_address == 0) {
|
||||
kprintf("Null pointer dereference in the kernel.\n");
|
||||
}
|
||||
|
||||
kprintf("Page fault! (p:%d,rw:%d,user:%d,res:%d,id:%d) at 0x%x\n", present, rw, user, reserved, id, faulting_address);
|
||||
HALT_AND_CATCH_FIRE("Page fault");
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ start_shell() {
|
||||
char * save;
|
||||
pch = strtok_r(buffer," ",&save);
|
||||
cmd = pch;
|
||||
if (!cmd) { continue; }
|
||||
char * argv[1024]; /* Command tokens (space-separated elements) */
|
||||
int tokenid = 0;
|
||||
while (pch != NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user