Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
Instance: win32: Use the secure flavor of vsnprintf
· a027be08
Hugo Beauzée-Luyssen
authored
Oct 26, 2017
a027be08
Instance: win32: Don't ignore potential sprintf_s errors
· eb8dca85
Hugo Beauzée-Luyssen
authored
Oct 26, 2017
eb8dca85
Hide whitespace changes
Inline
Side-by-side
vlcpp/Instance.hpp
View file @
eb8dca85
...
...
@@ -254,10 +254,12 @@ public:
#else
//MSVC treats passing nullptr as 1st vsnprintf(_s) as an error
char
psz_msg
[
512
];
if
(
vsnprintf
(
psz_msg
,
sizeof
(
psz_msg
)
-
1
,
format
,
va
)
<
0
)
if
(
_
vsnprintf
_s
(
psz_msg
,
_TRUNCATE
,
format
,
va
)
<
0
)
return
;
char
psz_ctx
[
1024
];
sprintf_s
(
psz_ctx
,
"[%s] (%s:%d) %s"
,
psz_module
,
psz_file
,
i_line
,
psz_msg
);
if
(
sprintf_s
(
psz_ctx
,
"[%s] (%s:%d) %s"
,
psz_module
,
psz_file
,
i_line
,
psz_msg
)
<
0
)
return
;
#endif
logCb
(
level
,
ctx
,
std
::
string
{
psz_ctx
}
);
};
...
...