diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ed37e0c..453e5d30 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,6 +113,7 @@ jobs: with: distribution: 'temurin' java-version: '17' + - name: Get CMake (Android) if: ${{ matrix.android }} uses: lukka/get-cmake@latest diff --git a/ISLE/android/config.cpp b/ISLE/android/config.cpp index a2d8e7bc..21e353f0 100644 --- a/ISLE/android/config.cpp +++ b/ISLE/android/config.cpp @@ -10,9 +10,10 @@ void Android_SetupDefaultConfigOverrides(dictionary* p_dictionary) SDL_Log("Overriding default config for Android"); const char* data = SDL_GetAndroidExternalStoragePath(); - char* savedata = new char[strlen(data) + strlen("/saves/") + 1]; - strcpy(savedata, data); - strcat(savedata, "/saves/"); + size_t len = SDL_strlen(data) + SDL_strlen("/saves/") + 1; + char* savedata = new char[len]; + SDL_strlcpy(savedata, data, len); + SDL_strlcat(savedata, "/saves/", len); if (!SDL_GetPathInfo(savedata, NULL)) { SDL_CreateDirectory(savedata); diff --git a/ISLE/android/config.h b/ISLE/android/config.h index 026d1ef1..5b4ac3d0 100644 --- a/ISLE/android/config.h +++ b/ISLE/android/config.h @@ -1,4 +1,3 @@ - #ifndef ANDROID_CONFIG_H #define ANDROID_CONFIG_H diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index c0b5b4e1..9ac67f14 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -1034,9 +1034,10 @@ bool IsleApp::LoadConfig() #elif defined(ANDROID) // SDL_GetAndroidExternalStoragePath() returns without a trailing / resulting in "filesisle.ini" :( const char* androidPath = SDL_GetAndroidExternalStoragePath(); - char* prefPath = new char[strlen(androidPath) + 2]; - strcpy(prefPath, androidPath); - strcat(prefPath, "/"); + size_t len = SDL_strlen(androidPath) + 2; + char* prefPath = new char[len]; + SDL_strlcpy(prefPath, androidPath, len); + SDL_strlcat(prefPath, "/", len); #else char* prefPath = SDL_GetPrefPath("isledecomp", "isle"); #endif @@ -1242,7 +1243,7 @@ bool IsleApp::LoadConfig() iniparser_freedict(dict); delete[] iniConfig; -#if !defined(IOS) && !defined(ANDROID) +#ifndef IOS SDL_free(prefPath); #endif