Skip to content

Commit 66e09bc

Browse files
committed
Merge pull request opencv#10260 from native-api:ffmpeg_load_from_package
2 parents cd7526c + 4bee238 commit 66e09bc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/videoio/src/cap_ffmpeg.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ class icvInitFFMPEG
124124
if (m)
125125
{
126126
wchar_t path[MAX_PATH];
127-
size_t sz = GetModuleFileNameW(m, path, sizeof(path));
128-
if (sz > 0 && ERROR_SUCCESS == GetLastError())
127+
const size_t path_size = sizeof(path)/sizeof(*path);
128+
size_t sz = GetModuleFileNameW(m, path, path_size);
129+
/* Don't handle paths longer than MAX_PATH until that becomes a real issue */
130+
if (sz > 0 && sz < path_size)
129131
{
130132
wchar_t* s = wcsrchr(path, L'\\');
131133
if (s)

0 commit comments

Comments
 (0)