shithub: aacenc

Download patch

ref: cc91e09b9d1f0f8106f4acfa56fa198496d599d0
parent: dab6333dcddf2a77a6d46430356a1d2a0fc3652c
author: knik <knik@users.sourceforge.net>
date: Wed Jul 26 02:56:57 EDT 2017

--track,--disc,--genre options parameter check

--- a/frontend/main.c
+++ b/frontend/main.c
@@ -600,16 +600,21 @@
             album = optarg;
             break;
         case TRACK_FLAG:
-            sscanf(optarg, "%d/%d", &trackno, &ntracks);
+            if (sscanf(optarg, "%d/%d", &trackno, &ntracks) < 1)
+                dieMessage = "Wrong track number.\n";
             break;
         case DISC_FLAG:
-            sscanf(optarg, "%d/%d", &discno, &ndiscs);
+            if (sscanf(optarg, "%d/%d", &discno, &ndiscs) < 1)
+                dieMessage = "Wrong disc number.\n";
             break;
         case COMPILATION_FLAG:
             compilation = 0x1;
             break;
         case GENRE_FLAG:
-            genre = atoi(optarg) + 1;
+            genre = atoi(optarg);
+            if ((genre < 0) || (genre > 146))
+                dieMessage = "Genre number out of range.\n";
+            genre++;
             break;
         case YEAR_FLAG:
             year = optarg;