plug some unbounded sscanf in getopt processing

This commit is contained in:
avsm 2003-04-26 20:42:00 +00:00
parent 1ca0b73f8c
commit cfc8dabb88

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-frontend_main_c,v 1.3 2003/04/26 20:42:00 avsm Exp $
--- frontend/main.c.orig Sat Apr 26 21:32:51 2003
+++ frontend/main.c Sat Apr 26 21:33:44 2003
@@ -542,7 +542,7 @@ int main(int argc, char *argv[])
case 's':
if (optarg) {
char dr[10];
- if (sscanf(optarg, "%s", dr) < 1) {
+ if (sscanf(optarg, "%9s", dr) < 1) {
def_srate = 0;
} else {
def_srate = atoi(dr);
@@ -552,7 +552,7 @@ int main(int argc, char *argv[])
case 'f':
if (optarg) {
char dr[10];
- if (sscanf(optarg, "%s", dr) < 1) {
+ if (sscanf(optarg, "%9s", dr) < 1) {
format = 1;
} else {
format = atoi(dr);
@@ -564,7 +564,7 @@ int main(int argc, char *argv[])
case 'b':
if (optarg) {
char dr[10];
- if (sscanf(optarg, "%s", dr) < 1) {
+ if (sscanf(optarg, "%9s", dr) < 1) {
outputFormat = FAAD_FMT_16BIT; /* just use default */
} else {
outputFormat = atoi(dr);
@@ -576,7 +576,7 @@ int main(int argc, char *argv[])
case 'l':
if (optarg) {
char dr[10];
- if (sscanf(optarg, "%s", dr) < 1) {
+ if (sscanf(optarg, "%9s", dr) < 1) {
object_type = LC; /* default */
} else {
object_type = atoi(dr);