From 681e4f5d922b9f0ea968238750d5c5d748eac809 Mon Sep 17 00:00:00 2001 From: Yan Zhu Date: Tue, 12 Sep 2023 00:03:09 +0800 Subject: docproc: avoid segfault during file closing In the function find_export_symbols, since the fopen file does not exit when it fails, there is a dereference problem in fclose(fp), which will cause a segmentation fault. Signed-off-by: Yan Zhu Signed-off-by: Denys Vlasenko --- scripts/basic/docproc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c index 4464e18..8828901 100644 --- a/scripts/basic/docproc.c +++ b/scripts/basic/docproc.c @@ -180,6 +180,7 @@ void find_export_symbols(char * filename) { fprintf(stderr, "docproc: "); perror(real_filename); + exit(1); } while (fgets(line, MAXLINESZ, fp)) { unsigned char *p; -- cgit v1.1