mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-10-21 15:57:32 +00:00
fix unbounded write of sprintf
Buffer write operations that do not control the length of data written may overflow. Fix by replacing sprintf() with snprintf().
This commit is contained in:
1 parent
014af67397
commit
274d3db34d
2 files changed
+5
-5
No files matched your search
+3
-3
@@ -411,11 +411,11 @@ void config_parse(int argc, char* argv[], PCONFIGURATION config) {
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
const char *dir;
|
||||
if ((dir = getenv("XDG_CACHE_DIR")) != NULL)
|
||||
sprintf(config->key_dir, "%s" MOONLIGHT_PATH, dir);
|
||||
snprintf(config->key_dir, sizeof(config->key_dir), "%s" MOONLIGHT_PATH, dir);
|
||||
else if ((dir = getenv("HOME")) != NULL)
|
||||
sprintf(config->key_dir, "%s" DEFAULT_CACHE_DIR MOONLIGHT_PATH, dir);
|
||||
snprintf(config->key_dir, sizeof(config->key_dir), "%s" DEFAULT_CACHE_DIR MOONLIGHT_PATH, dir);
|
||||
else
|
||||
sprintf(config->key_dir, "%s" DEFAULT_CACHE_DIR MOONLIGHT_PATH, pw->pw_dir);
|
||||
snprintf(config->key_dir, sizeof(config->key_dir), "%s" DEFAULT_CACHE_DIR MOONLIGHT_PATH, pw->pw_dir);
|
||||
}
|
||||
|
||||
if (config->stream.bitrate == -1) {
|
||||
|
||||
Reference in new issue
Block a user