Commits

ecsv committed 3a99cd5

Correctly calculate swprintf max string size instead of buffer size

  • Participants
  • Parent commits d686691

Comments (0)

Files changed (1)

File src/Glide64/Main.cpp

 
       ghq_dmptex_toggle_key = 0;
 
-      swprintf(romname, 256, L"%hs", rdp.RomName);
-      swprintf(foldername, sizeof(foldername), L"%hs", ConfigGetUserDataPath());
-      swprintf(cachename, sizeof(cachename), L"%hs", ConfigGetUserCachePath());
+      swprintf(romname, sizeof(romname) / sizeof(*romname), L"%hs", rdp.RomName);
+      swprintf(foldername, sizeof(foldername) / sizeof(*foldername), L"%hs", ConfigGetUserDataPath());
+      swprintf(cachename, sizeof(cachename) / sizeof(*cachename), L"%hs", ConfigGetUserCachePath());
 
       settings.ghq_use = (int)ext_ghq_init(voodoo.max_tex_size, // max texture width supported by hardware
         voodoo.max_tex_size, // max texture height supported by hardware