NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/59666: audioplay(1): volume (-v) not checked for valid integer



>Number:         59666
>Category:       bin
>Synopsis:       audioplay(1): volume (-v) not checked for valid integer
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 23 06:50:00 +0000 2025
>Originator:     RVP
>Release:        HEAD, 11, 10, 9
>Organization:
>Environment:
NetBSD/amd64 11.99.3
>Description:
Screw up the argument to -v (I assumed -v was `verbose') like so:

$ audioplay -v x.wav

audioplay will now set volume to 0, then wait for input from stdin.
This is hella confusing.
>How-To-Repeat:
As above.
>Fix:
Validate argument to `-v'.

```
diff -urN audio.orig/play/play.c audio/play/play.c
--- audio.orig/play/play.c	2024-03-04 17:42:13.281628348 +0000
+++ audio/play/play.c	2025-09-23 06:40:09.131535140 +0000
@@ -154,7 +154,9 @@
 			verbose++;
 			break;
 		case 'v':
-			volume = atoi(optarg);
+			if (*optarg == '\0')
+				errx(1, "volume must be an integer");
+			decode_int(optarg, &volume);
 			if (volume < 0 || volume > 255)
 				errx(1, "volume must be between 0 and 255");
 			break;
```



Home | Main Index | Thread Index | Old Index