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

Uninitialized variable in info_scr.c (display_levels()). #64

Closed
textbrowser opened this issue May 21, 2019 · 4 comments
Closed

Uninitialized variable in info_scr.c (display_levels()). #64

textbrowser opened this issue May 21, 2019 · 4 comments

Comments

@textbrowser
Copy link

The variable sig_qual_max should be initialized as the following conditions may not be true.

	if (linkstat.data.bss_signal_qual) {
		/* BSS_SIGNAL_UNSPEC is scaled 0..100 */
		sig_qual     = linkstat.data.bss_signal_qual;
		sig_qual_max = 100;
	} else if (sig_level) {
		if (sig_level < -110)
			sig_qual = 0;
		else if (sig_level > -40)
			sig_qual = 70;
		else
			sig_qual = sig_level + 110;
		sig_qual_max = 70;
	}
@textbrowser textbrowser changed the title Uninitialized variable in info_scr.c (display_levels). Uninitialized variable in info_scr.c (display_levels()). May 21, 2019
@grrtrr
Copy link
Contributor

grrtrr commented May 23, 2019

Thank you. The logic avoids using sig_qual_max if sig_qual has not been set (-1), but I will initialize it none the less.

@grrtrr grrtrr closed this as completed in 319fe75 May 23, 2019
@textbrowser
Copy link
Author

Sorry to bother you again. The variable should be initialized to a non-zero value so as to avoid an unlikely division by zero.

@grrtrr
Copy link
Contributor

grrtrr commented May 26, 2019

sig_qual_max > 0 iff sig_qual > -1. It is not supposed to be used when sig_qual == -1.

@textbrowser
Copy link
Author

OK. :)

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

No branches or pull requests

2 participants