Date: Sat, 27 Feb 2021 19:02:16 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 253736] backlight(8) arg parsing can be tricked in a small way Message-ID: <bug-253736-227-YeNvGgvx9P@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-253736-227@https.bugs.freebsd.org/bugzilla/> References: <bug-253736-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D253736 --- Comment #2 from David Schlachter <fbsd-bugzilla@schlachter.ca> --- Simple fix: diff --git a/usr.bin/backlight/backlight.c b/usr.bin/backlight/backlight.c index 1dae0cfe5c6..180b9114876 100644 --- a/usr.bin/backlight/backlight.c +++ b/usr.bin/backlight/backlight.c @@ -98,7 +98,7 @@ main(int argc, char *argv[]) BACKLIGHTGETSTATUS, BACKLIGHTUPDATESTATUS, BACKLIGHTGETINFO}; - long percent =3D 0; + long percent =3D -1; const char *percent_error; uint32_t i; bool setname; @@ -196,7 +196,7 @@ main(int argc, char *argv[]) case BACKLIGHT_DECR: if (ioctl(fd, BACKLIGHTGETSTATUS, &props) =3D=3D -1) errx(1, "Cannot query the backlight device"); - percent =3D percent =3D=3D 0 ? 10 : percent; + percent =3D percent =3D=3D -1 ? 10 : percent; percent =3D action =3D=3D BACKLIGHT_INCR ? percent : -perce= nt; props.brightness +=3D percent; if ((int)props.brightness < 0) --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-253736-227-YeNvGgvx9P>