Commit 11de39e2fbbc592018e0a231d0ee773653dcc8d6

Authored by Marcin Garski
Committed by Sam Ravnborg
1 parent 767e581d75

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>

Showing 2 changed files with 2 additions and 2 deletions Side-by-side Diff

scripts/kconfig/lex.zconf.c_shipped
... ... @@ -2264,7 +2264,7 @@
2264 2264 FILE *f;
2265 2265  
2266 2266 f = fopen(name, "r");
2267   - if (!f && name[0] != '/') {
  2267 + if (!f && name != NULL && name[0] != '/') {
2268 2268 env = getenv(SRCTREE);
2269 2269 if (env) {
2270 2270 sprintf(fullname, "%s/%s", env, name);
scripts/kconfig/zconf.l
... ... @@ -265,7 +265,7 @@
265 265 FILE *f;
266 266  
267 267 f = fopen(name, "r");
268   - if (!f && name[0] != '/') {
  268 + if (!f && name != NULL && name[0] != '/') {
269 269 env = getenv(SRCTREE);
270 270 if (env) {
271 271 sprintf(fullname, "%s/%s", env, name);