shithub: openh264

Download patch

ref: 50e49f370451ba3209593e4e7a5066507cf92f81
parent: 9d244abb22f094bc1b96d49e04a104d7fc35f812
parent: f6a46960c938f0bf0a674b546ba3ea99e38c01da
author: Ethan Hugg <ethanhugg@gmail.com>
date: Wed Feb 19 04:26:00 EST 2014

Merge pull request #310 from mstorsjo/remove-unused-variables

Avoid declaring unused variables

--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -542,14 +542,17 @@
     }
 
     else if (!strcmp (pCommand, "-drec") && (n + 1 < argc)) {
+#ifdef ENABLE_FRAME_DUMP
       unsigned int	iLayer = atoi (argv[n++]);
       const int iLen = strlen (argv[n]);
-#ifdef ENABLE_FRAME_DUMP
       SDLayerParam* pDLayer = &pSvcParam.sDependencyLayers[iLayer];
+      if (iLen >= sizeof(pDLayer->sRecFileName))
+        return 1;
       pDLayer->sRecFileName[iLen] = '\0';
-      strncpy (pDLayer->sRecFileName, argv[n], iLen);	// confirmed_safe_unsafe_usage
+      strncpy (pDLayer->sRecFileName, argv[n++], iLen);	// confirmed_safe_unsafe_usage
+#else
+      n += 2;
 #endif//ENABLE_FRAME_DUMP
-      n++;
     }
 
     else if (!strcmp (pCommand, "-sw") && (n + 1 < argc)) {