Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Segfault in iperf_err(exit) #1807

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

martin-ottens
Copy link

  • Version of iperf3 (or development branch, such as master or
    3.1-STABLE) to which this pull request applies: all

  • Issues fixed (if any): -

  • Brief description of code changes (suitable for use as a commit message): Fix Segfault in iperf_err(exit)

In some places iperf_err and iperf_errexit are called with NULL for the parameter struct iperf_test *test. In this case the pthread_mutex_lock call will Segfault. Fixed by adding a NULL-check.

Reproduce this Segfault Example of a usage of `iperf_errexit` with `NULL` (here)[https://github.com/esnet/iperf/blob/master/src/iperf_util.c#L68]. (Reproduce with a full `/tmp` filesystem, `readentropy` will fail)

Valgrind output:

==2274== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==2274==  Access not within mapped region at address 0x10
==2274==    at 0x49559E4: pthread_mutex_lock@@GLIBC_2.2.5 (pthread_mutex_lock.c:80)
==2274==    by 0x48A94B8: iperf_errexit (iperf_error.c:114)
==2274==    by 0x48A95BF: readentropy (iperf_util.c:74)
==2274==    by 0x48A279D: iperf_new_stream (iperf_api.c:4487)
==2274==    by 0x48AC633: iperf_run_server (iperf_server_api.c:786)
==2274==    by 0x1092FD: run (main.c:169)
==2274==    by 0x109068: main (main.c:124)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant