mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-14 23:34:08 +00:00
UI: Fix snprintf calls with literals as buffer sizes
This commit is contained in:
parent
5913be9198
commit
4ff789e24c
|
@ -376,7 +376,7 @@ static void do_log(int log_level, const char *msg, va_list args, void *param)
|
|||
va_copy(args2, args);
|
||||
#endif
|
||||
|
||||
vsnprintf(str, 4095, msg, args);
|
||||
vsnprintf(str, sizeof(str), msg, args);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (IsDebuggerPresent()) {
|
||||
|
@ -2658,16 +2658,16 @@ static void move_to_xdg(void)
|
|||
if (!home)
|
||||
return;
|
||||
|
||||
if (snprintf(old_path, 512, "%s/.obs-studio", home) <= 0)
|
||||
if (snprintf(old_path, sizeof(old_path), "%s/.obs-studio", home) <= 0)
|
||||
return;
|
||||
|
||||
/* make base xdg path if it doesn't already exist */
|
||||
if (GetConfigPath(new_path, 512, "") <= 0)
|
||||
if (GetConfigPath(new_path, sizeof(new_path), "") <= 0)
|
||||
return;
|
||||
if (os_mkdirs(new_path) == MKDIR_ERROR)
|
||||
return;
|
||||
|
||||
if (GetConfigPath(new_path, 512, "obs-studio") <= 0)
|
||||
if (GetConfigPath(new_path, sizeof(new_path), "obs-studio") <= 0)
|
||||
return;
|
||||
|
||||
if (os_file_exists(old_path) && !os_file_exists(new_path)) {
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
static inline void OBSErrorBoxva(QWidget *parent, const char *msg, va_list args)
|
||||
{
|
||||
char full_message[4096];
|
||||
vsnprintf(full_message, 4095, msg, args);
|
||||
vsnprintf(full_message, sizeof(full_message), msg, args);
|
||||
|
||||
QMessageBox::critical(parent, "Error", full_message);
|
||||
}
|
||||
|
|
|
@ -373,13 +373,15 @@ void OBSBasic::DeleteProfile(const char *profileName, const char *profileDir)
|
|||
char profilePath[512];
|
||||
char basePath[512];
|
||||
|
||||
int ret = GetConfigPath(basePath, 512, "obs-studio/basic/profiles");
|
||||
int ret = GetConfigPath(basePath, sizeof(basePath),
|
||||
"obs-studio/basic/profiles");
|
||||
if (ret <= 0) {
|
||||
blog(LOG_WARNING, "Failed to get profiles config path");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = snprintf(profilePath, 512, "%s/%s/*", basePath, profileDir);
|
||||
ret = snprintf(profilePath, sizeof(profilePath), "%s/%s/*", basePath,
|
||||
profileDir);
|
||||
if (ret <= 0) {
|
||||
blog(LOG_WARNING, "Failed to get path for profile dir '%s'",
|
||||
profileDir);
|
||||
|
@ -404,7 +406,8 @@ void OBSBasic::DeleteProfile(const char *profileName, const char *profileDir)
|
|||
|
||||
os_globfree(glob);
|
||||
|
||||
ret = snprintf(profilePath, 512, "%s/%s", basePath, profileDir);
|
||||
ret = snprintf(profilePath, sizeof(profilePath), "%s/%s", basePath,
|
||||
profileDir);
|
||||
if (ret <= 0) {
|
||||
blog(LOG_WARNING, "Failed to get path for profile dir '%s'",
|
||||
profileDir);
|
||||
|
|
Loading…
Reference in a new issue