VirtualBox

Changeset 95851 in vbox


Ignore:
Timestamp:
Jul 26, 2022 11:38:31 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
152576
Message:

VBoxService/PageSharing: sprintf -> RTStrPrintf; strcat -> RTStrCat. bugref:10261

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp

    r93115 r95851  
    167167 * always use the wide version of the API and convert to UTF-8/whatever. */
    168168
    169         sprintf(szFileVersionLocation, TEXT("\\StringFileInfo\\%04x%04x\\FileVersion"), lpTranslate[i].wLanguage, lpTranslate[i].wCodePage);
     169        RTStrPrintf(szFileVersionLocation, sizeof(szFileVersionLocation),
     170                    "\\StringFileInfo\\%04x%04x\\FileVersion", lpTranslate[i].wLanguage, lpTranslate[i].wCodePage);
    170171        fRet = VerQueryValue(pVersionInfo, szFileVersionLocation, (LPVOID *)&pszFileVersion, &cbFileVersion);
    171172        if (fRet)
     
    444445                        break;
    445446
    446 /** @todo FullPathName not an UTF-8 string is! An ANSI string it is. */
     447/** @todo FullPathName not an UTF-8 string is! An ANSI string it is
     448 * according to the SYSTEM locale.  Best use RtlAnsiStringToUnicodeString to
     449 * convert to UTF-16. */
    447450                    strcpy(pModule->Info.szModule,
    448451                           (const char *)&pSystemModules->Modules[i].FullPathName[pSystemModules->Modules[i].OffsetToFileName]);
     
    454457                    {
    455458                        /* Seen just file names in XP; try to locate the file in the system32 and system32\drivers directories. */
    456                         strcat(szFullFilePath, "\\");
    457                         strcat(szFullFilePath, (const char *)pSystemModules->Modules[i].FullPathName);
     459                        RTStrCat(szFullFilePath, sizeof(szFullFilePath), "\\");
     460                        RTStrCat(szFullFilePath, sizeof(szFullFilePath), (const char *)pSystemModules->Modules[i].FullPathName);
    458461                        VGSvcVerbose(3, "Unexpected kernel module name try %s\n", szFullFilePath);
    459462                        if (RTFileExists(szFullFilePath) == false)
    460463                        {
    461464                            GetSystemDirectoryA(szFullFilePath, sizeof(szFullFilePath));
    462                             strcat(szFullFilePath, "\\drivers\\");
    463                             strcat(szFullFilePath, (const char *)pSystemModules->Modules[i].FullPathName);
     465                            RTStrCat(szFullFilePath, sizeof(szFullFilePath), "\\drivers\\");
     466                            RTStrCat(szFullFilePath, sizeof(szFullFilePath), (const char *)pSystemModules->Modules[i].FullPathName);
    464467                            VGSvcVerbose(3, "Unexpected kernel module name try %s\n", szFullFilePath);
    465468                            if (RTFileExists(szFullFilePath) == false)
     
    481484                        }
    482485
    483                         strcat(szFullFilePath, lpPath);
     486                        RTStrCat(szFullFilePath, sizeof(szFullFilePath), lpPath);
    484487                    }
    485488
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette