diff options
author | Mike Frysinger <vapier@gentoo.org> | 2008-06-27 19:12:50 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2008-06-27 19:12:50 +0000 |
commit | 63342ff906c121b36440ae7a41449e87f5b5f689 (patch) | |
tree | 2ac9184d7cdf36ea55a8439284212766edfaf4ab | |
parent | 0546f7ccc64bd8ea536c300dfac2c6efec7eeaa8 (diff) |
if argv[0] is NULL, dont try to parse it and subsequently crash ... found by running execve05 ltp test on blackfin ([#4194])
-rw-r--r-- | libc/misc/internals/__uClibc_main.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 351161593..6c0dab7fe 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -336,12 +336,14 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, __uclibc_progname = *argv; #ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ - program_invocation_name = *argv; - program_invocation_short_name = strrchr(*argv, '/'); - if (program_invocation_short_name != NULL) - ++program_invocation_short_name; - else - program_invocation_short_name = program_invocation_name; + if (*argv != NULL) { + program_invocation_name = *argv; + program_invocation_short_name = strrchr(*argv, '/'); + if (program_invocation_short_name != NULL) + ++program_invocation_short_name; + else + program_invocation_short_name = program_invocation_name; + } #endif #ifdef __UCLIBC_CTOR_DTOR__ |