Browse Source

kconfig: fix mconf segmentation fault

I have found small bug in mconf, when you run it without any argument it
will sigsegv.

Without patch:
$ scripts/kconfig/mconf
Segmentation fault

With patch:
$ scripts/kconfig/mconf
can't find file (null)

Signed-off-by: Marcin Garski <mgarski@post.pl>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Marcin Garski 18 năm trước cách đây
mục cha
commit
11de39e2fb
2 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 1 1
      scripts/kconfig/lex.zconf.c_shipped
  2. 1 1
      scripts/kconfig/zconf.l

+ 1 - 1
scripts/kconfig/lex.zconf.c_shipped

@@ -2264,7 +2264,7 @@ FILE *zconf_fopen(const char *name)
 	FILE *f;
 
 	f = fopen(name, "r");
-	if (!f && name[0] != '/') {
+	if (!f && name != NULL && name[0] != '/') {
 		env = getenv(SRCTREE);
 		if (env) {
 			sprintf(fullname, "%s/%s", env, name);

+ 1 - 1
scripts/kconfig/zconf.l

@@ -265,7 +265,7 @@ FILE *zconf_fopen(const char *name)
 	FILE *f;
 
 	f = fopen(name, "r");
-	if (!f && name[0] != '/') {
+	if (!f && name != NULL && name[0] != '/') {
 		env = getenv(SRCTREE);
 		if (env) {
 			sprintf(fullname, "%s/%s", env, name);