Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Usage of vsnprintf() drops last character #14

@grimfang4

Description

@grimfang4

vsnprintf() expects a string of size _BufferCount - 1 because it always appends a null terminator (see https://www.cplusplus.com/reference/cstdio/vsnprintf/). This causes strprintf() to drop the last character.

A tested fix with Visual Studio 2022 is using bytes_needed + 1:

vsnprintf(&str[0], bytes_needed, format, vlist);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions