fix: strcmp protection with NULL args
This commit is contained in:
@ -1,10 +1,9 @@
|
||||
#include "kprintf.h"
|
||||
#include "string.h"
|
||||
#include "terminal.h"
|
||||
#include "utils.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define ARRAY_SIZE(array) sizeof(array) / sizeof(array[0])
|
||||
|
||||
void color_cmd(char *arg)
|
||||
{
|
||||
uint8_t tmp_color;
|
||||
@ -21,16 +20,14 @@ void color_cmd(char *arg)
|
||||
}
|
||||
}
|
||||
tmp_color = terminal_get_default_color();
|
||||
kprintf(KERN_WARNING "Invalid argument\navailable color: ");
|
||||
kprintf(KERN_WARNING "Invalid argument\n");
|
||||
kprintf("Available colors: ");
|
||||
for (size_t i = 0; i < ARRAY_SIZE(colors); i++) {
|
||||
terminal_set_default_fg_color(i);
|
||||
// Unai the STRING MERGE argument of kprintf cause me a
|
||||
// cramptissue. I lost all my skibidi aura to fix it but it work
|
||||
// (;
|
||||
kprintf(colors[i]);
|
||||
if (i != ARRAY_SIZE(colors) - 1)
|
||||
kprintf(", ");
|
||||
}
|
||||
terminal_set_default_fg_color(tmp_color);
|
||||
kprintf("\n");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user