rollraw / qo0-csgo

internal cs:go cheat base/template
https://www.unknowncheats.me/forum/cs-go-releases/585900-v2-qo0s-internal-cheat-base-template.html
MIT License
333 stars 101 forks source link

CRT::StringPrint && CRT::StringPrintN should using stb_sprintf #237

Open maecry opened 1 year ago

maecry commented 1 year ago

https://github.com/rollraw/qo0-csgo/blob/c477e85116d43a534dcb8e887c48091ae4146514/base/utilities/crt.h#L710

        inline Q_CRT_FORMAT_STRING_ATTRIBUTE(printf, 2, 3) int StringPrint(char* szBuffer, const char* const szFormat, ...)
    {
        va_list args;
        va_start(args, szFormat);

        const int iReturn = stbsp_vsprintf(szBuffer, szFormat, args);

        va_end(args);

        return iReturn;
    }

https://github.com/rollraw/qo0-csgo/blob/c477e85116d43a534dcb8e887c48091ae4146514/base/utilities/crt.h#L764

    Q_INLINE Q_CRT_FORMAT_STRING_ATTRIBUTE(printf, 3, 4) int StringPrintN(char* szBuffer, std::size_t nCount, const char* const szFormat, ...)
    {
            // @note: same as https://github.com/rollraw/qo0-csgo/blob/c477e85116d43a534dcb8e887c48091ae4146514/dependencies/imgui/imgui.cpp#L1373
        va_list args;
        va_start(args, szFormat);

        const int iReturn = stbsp_vsnprintf(szBuffer, static_cast<int>(nCount), szFormat, args);

        va_end(args);

        if (szBuffer == nullptr)
                    return iReturn ;
                if (iReturn  == -1 || w >= (int)nCount)
                    iReturn  = (int)nCount - 1;
                szBuffer[iReturn] = 0;

        return iReturn;
    }

or we should add a configuration in user.h as Q_USE_USE_STB_SPRINTF since we don't really need to sig scan this, such as waste as we already using stb_sprintf

note: There might be typos cuz yes I typed on github

rollraw commented 1 year ago

this is a good find.

maecry commented 1 year ago

come up to this when I used your crt.hpp with cs2 😅and sigs scan the stringprint is a no good