fix: nvm strcmp should crash on NULL, color cmd is now protected though
This commit is contained in:
@ -13,12 +13,16 @@ void color_cmd(char *arg)
|
||||
"DARK_GREY", "LIGHT_BLUE", "LIGHT_GREEN", "LIGHT_CYAN",
|
||||
"LIGHT_RED", "LIGHT_MAGENTA", "LIGHT_YELLOW", "WHITE",
|
||||
};
|
||||
|
||||
if (!arg)
|
||||
goto invalid;
|
||||
for (size_t i = 0; i < ARRAY_SIZE(colors); i++) {
|
||||
if (strcmp(colors[i], arg) == 0) {
|
||||
terminal_change_default_fg_color(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
invalid:
|
||||
tmp_color = terminal_get_default_color();
|
||||
kprintf(KERN_WARNING "Invalid argument\n");
|
||||
kprintf("Available colors: ");
|
||||
|
Reference in New Issue
Block a user