Skip to content

GetStringTableData uses string conversion function but can contain raw bytes #1230

@thewavelength

Description

@thewavelength

Help us help you

  • I have checked that my issue doesn't exist yet.
  • I have tried my absolute best to reduce the problem-space and have provided the absolute smallest test-case possible.
  • I can always reproduce the issue with the provided description below.

Environment

  • Operating System version: Windows 10
  • Game/AppID (with version if applicable): CS:GO
  • Current SourceMod version: 1.10.0.6.6460

Description

Some network string tables inside the engine send raw data from meory, not strings (e. g. the userinfo table as seen here). Sadly, SourceMod uses a bytes-to-string conversion function inside GetStringTableData, so everything after \0 is truncated.

Problem:

pContext->StringToLocalUTF8(params[3], params[4], userdata, &numBytes);

(Same goes true for SetStringTableData).

Problematic Code (or Steps to Reproduce)

You can validate by reading any userinfo entry with GetStringTableData and compare the return value (which is the length of string characters read instead of bytes read) with GetStringTableDataLength (which returns the correct size).

Possible solution

Either create an additional function to read raw data or allow to specify a flag to the function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions