check whether savedptr is NULL before invoking strlen

savedptr can be null in musl libc, so the strlen(NULL) will segfault

Signed-off-by: Chao Liu <liuchao173@huawei.com>
This commit is contained in:
Chao Liu 2022-06-08 10:04:02 +08:00
parent 4afec6e4f8
commit 522883505d
1 changed files with 1 additions and 1 deletions

View File

@ -178,7 +178,7 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq)
}
#ifdef AARCH64
if (strlen(savedptr) > 0) {
if (savedptr && strlen(savedptr) > 0) {
snprintf(irq_fullname, PATH_MAX, "%s %s", last_token, savedptr);
tmp = strchr(irq_fullname, '\n');
if (tmp)