backlight: check the lenght if the input before trimming '%'
Reported by: hps Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D26693
This commit is contained in:
parent
4f4e6bae77
commit
9b68e79fe0
@ -145,7 +145,8 @@ main(int argc, char *argv[])
|
||||
|
||||
if (argc == 1) {
|
||||
/* ignore a trailing % for user friendlyness */
|
||||
if (argv[0][strlen(argv[0]) - 1] == '%')
|
||||
if (strlen(argv[0]) > 0 &&
|
||||
argv[0][strlen(argv[0]) - 1] == '%')
|
||||
argv[0][strlen(argv[0]) - 1] = '\0';
|
||||
percent = strtonum(argv[0], 0, 100, &percent_error);
|
||||
if (percent_error)
|
||||
|
Loading…
Reference in New Issue
Block a user