diff options
author | Arun Sharma <asharma@fb.com> | 2012-08-04 18:01:46 -0700 |
---|---|---|
committer | Arun Sharma <asharma@fb.com> | 2012-08-04 18:06:07 -0700 |
commit | 707b1dba99323c80ed9730870f6eab949f5b9b98 (patch) | |
tree | b6b1a60288a0e83cc2eedd4124f6afed72df5e28 /tests/test-ptrace.c | |
parent | 32202619c42f58a9dac6eee3b9a4c231f1ce394a (diff) | |
download | libunwind-707b1dba99323c80ed9730870f6eab949f5b9b98.tar.gz |
Fix a SIGSEGV in test-ptrace.c
./test-ptrace -v resulted in a SIGSEGV.
Diffstat (limited to 'tests/test-ptrace.c')
-rw-r--r-- | tests/test-ptrace.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test-ptrace.c b/tests/test-ptrace.c index c9f8f2e9..8f2e1cb1 100644 --- a/tests/test-ptrace.c +++ b/tests/test-ptrace.c @@ -204,6 +204,8 @@ main (int argc, char **argv) ++optind, print_names = 0; else fprintf(stderr, "unrecognized option: %s\n", argv[optind++]); + if (optind >= argc) + break; } target_pid = fork (); @@ -221,6 +223,11 @@ main (int argc, char **argv) #else #error Trace me #endif + + if (optind == argc) { + fprintf(stderr, "Need to specify a command line for the child\n"); + exit (-1); + } execve (argv[optind], argv + optind, environ); _exit (-1); } |