-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add constants for max IP and SteamID length #566
Conversation
It should be |
@WPMGPRoSToTeMa I know, but I made it |
Looks good for me. Do you see something else, @WPMGPRoSToTeMa? |
@Arkshine constants for resource path, userinfo, motd, menu length? |
Resource path -> 64 What do you mean by 'userinfo', and 'menu length'? |
@Arkshine motd -> 1536.
Menu contents length -> 512. |
Sounds good. |
Don't forget PLATFORM_MAX_PATH |
It's defined to 260 because this would be the max path length in windows. |
also don't forget |
I added these: #define MAX_RESOURCE_PATH_LENGTH 64
#define MAX_MOTD_LENGTH 1536
#define MAX_USER_INFO_LENGTH 256
#define MAX_MENU_LENGTH 512
#define MAX_QUERY_LENGTH 1472 |
What kind of query you're talking about? Where did you see this constant? |
@Arkshine I think he's talking about SQL queries. |
Why 1472? The limit would be the limit defined by some MySQL options, like maybe |
Nah, at most the MySQL module should log a warning that the query string has exceeded maximum size. A constant is unnecessary. |
Compiler input line length is pretty unrelated to query length, since usually (long queries) are built (as in, not just a string literal, but lots of stuff inserted into the string). I think the 4096 current limit is pretty low btw, it's common to have single INSERT queries that you build with multiple values, instead of thousands of single value queries. These long INSERT queries are many kilobytes or megabytes long if you don't split them so as to fit with the current limit. You probably can't, or shouldn't at least, allocate megabytes in the stack of an AMXX plugin , but 16K is probably within reason. I'm currently using this constant, so it might be useful to add. However I think the name should be different, like SQL_MAX_QUERY_LENGTH and be included in sqlx.inc |
The solution is to introduce transactions for such queries if they are the main problem. |
What about the maximum hostname length? Is it 64? |
Let's go with that for now. If we need others constants, feel free to open a new PR. |
* Add constants for max IP and SteamID length * Change max authid length to 64 * Fix port typo * Add more defines * Remove max query length
It is not the same in different games. |
/** | ||
* The maximum buffer size that can be displayed in a MOTD. | ||
*/ | ||
#define MAX_MOTD_LENGTH 1536 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry, looks like it is not the same for different games too:
https://github.com/ValveSoftware/halflife/blob/5d761709a31ce1e71488f2668321de05f791b405/dmc/cl_dll/hud.h#L56
https://github.com/ValveSoftware/halflife/blob/5d761709a31ce1e71488f2668321de05f791b405/cl_dll/hud.h#L61
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but we don't know current code base.
hl now support color menus. what else has changed in current builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mistrick that repository contains colored menu support.
I'm just not sure if the max SteamID length is 34. I wasn't able to find the best answer.