We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4af3ca4 commit 4bee238Copy full SHA for 4bee238
modules/videoio/src/cap_ffmpeg.cpp
@@ -124,8 +124,10 @@ class icvInitFFMPEG
124
if (m)
125
{
126
wchar_t path[MAX_PATH];
127
- size_t sz = GetModuleFileNameW(m, path, sizeof(path));
128
- if (sz > 0 && ERROR_SUCCESS == GetLastError())
+ const size_t path_size = sizeof(path)/sizeof(*path);
+ 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)
131
132
wchar_t* s = wcsrchr(path, L'\\');
133
if (s)
0 commit comments