Skip to content

Add MAX_STEAMID_LENGTH#1696

Merged
asherkin merged 1 commit intoalliedmodders:masterfrom
sirdigbot:steamid-size-constant
Feb 15, 2022
Merged

Add MAX_STEAMID_LENGTH#1696
asherkin merged 1 commit intoalliedmodders:masterfrom
sirdigbot:steamid-size-constant

Conversation

@sirdigbot
Copy link
Contributor

@sirdigbot sirdigbot commented Jan 21, 2022

I feel like this is sorely missing since I've had to define it in so many plugins I've written.

The maximum theoretical size of a 'valid' SteamID (according to the valve wiki) is 23 bytes including null STEAM_255:1:2147483647.

The only exception that I know of is STEAM_ID_STOP_IGNORING_RETVALS which is 31* bytes including null.

In the interest of keeping that error value meaningful, either:

  • It should be changed to fit within 23 bytes, which could potentially break something for no reason.
  • There should be only 1 constant for the size of a SteamID that not only fits every type of ID but also the error message.

@sirdigbot
Copy link
Contributor Author

* - I didn't realise the size was off by 1 until I already hit submit, but I'm not sure if it should be changed

@KyleSanderson
Copy link
Member

@asherkin I remember you had reservations about hard coding steam authentication eons ago (which we well moved on from, which was also well before steam|/3). Based on the trajectory I'm OK with this. Fun/base have this at 64 chars right now on a [3][64] array. Long term to avoid the MAXPLAYERS+2 issue I think we want to reserve a 128b rendered value. WDYT?

Copy link
Member

@asherkin asherkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 32 seems like a good length to me.

@asherkin
Copy link
Member

That said, I think this should be MAX_AUTHID_LENGTH - the SM API doesn't use "SteamID" at the top-level.

@asherkin asherkin force-pushed the steamid-size-constant branch from 90c56dc to 7ab9344 Compare February 15, 2022 09:56
@asherkin
Copy link
Member

It turns out that Valve actually have this defined in the SDK

#define      MAX_NETWORKID_LENGTH            64  // num chars for a network (i.e steam) ID

@asherkin asherkin merged commit addfb3c into alliedmodders:master Feb 15, 2022
@sirdigbot sirdigbot deleted the steamid-size-constant branch February 16, 2022 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants