shithub: openh264

Download patch

ref: f6a46960c938f0bf0a674b546ba3ea99e38c01da
parent: fd100598abf639e18ea476267dee225f46746395
author: Martin Storsjö <[email protected]>
date: Wed Feb 19 05:41:50 EST 2014

Check a string length before doing a strncpy

--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -546,6 +546,8 @@
       unsigned int	iLayer = atoi (argv[n++]);
       const int iLen = strlen (argv[n]);
       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
 #else