diff --git a/libgamestream/http.c b/libgamestream/http.c index 795fb0d8..0ca97f05 100644 --- a/libgamestream/http.c +++ b/libgamestream/http.c @@ -51,10 +51,10 @@ int http_init(const char* keyDirectory, int logLevel) { return GS_FAILED; char certificateFilePath[4096]; - sprintf(certificateFilePath, "%s/%s", keyDirectory, CERTIFICATE_FILE_NAME); + snprintf(certificateFilePath, sizeof(certificateFilePath), "%s/%s", keyDirectory, CERTIFICATE_FILE_NAME); char keyFilePath[4096]; - sprintf(&keyFilePath[0], "%s/%s", keyDirectory, KEY_FILE_NAME); + snprintf(keyFilePath, sizeof(keyFilePath), "%s/%s", keyDirectory, KEY_FILE_NAME); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1L); diff --git a/src/config.c b/src/config.c index b4da3aa6..59d797ea 100644 --- a/src/config.c +++ b/src/config.c @@ -504,11 +504,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); } #endif