You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If the current behavior is not an intended thing, all the following natives:
SHA256_PassHash
GetPlayerIp
GetPlayerVersion
GetPlayerName
GetSVarString
GetPVarString
gpci
should return the final actual length of a string if it was truncated.
SHA256_PassHash
To Reproduce
new str[32];// less than needed for hashnew ret = SHA256_PassHash("test", "78sdjs86d2h", str, sizeof str);
printf("ret %d, str '%s'", ret, str);
Expected behavior
ret 32, str 'CD16A1C8BF5792B48142FF6B67C9CB5B'
Current behavior
ret 65, str 'CD16A1C8BF5792B48142FF6B67C9CB5'
GetPlayerIp
To Reproduce
new str[3];// less than needed for ip addressnew ret = GetPlayerIp(playerid, str, sizeof str);
printf("ret %d, str '%s'", ret, str);
Expected behavior
ret 3, str '127'
Current behavior
ret 9, str '12'
GetPlayerVersion
To Reproduce
new str[3];// less than needed for versionnew ret = GetPlayerVersion(playerid, str, sizeof str);
printf("ret %d, str '%s'", ret, str);
Expected behavior
ret 3, str '0.3'
Current behavior
ret 5, str '0.'
GetPlayerName
To Reproduce
new str[3];// less than needed for namenew ret = GetPlayerName(playerid, str, sizeof str);
printf("ret %d, str '%s'", ret, str);
Expected behavior
ret 3, str 'Nex'
Current behavior
ret 6, str 'Ne'
GetSVarString
To Reproduce
new str[3];// less than needed for stringSetSVarString("test", "abracadabra");
new ret = GetSVarString("test", str, sizeof str);
printf("ret %d, str '%s'", ret, str);
Expected behavior
ret 3, str 'abr'
Current behavior
ret 11, str 'ab'
GetPVarString
To Reproduce
new str[3];// less than needed for stringSetPVarString(playerid, "test", "abracadabra");
new ret = GetPVarString(playerid, "test", str, sizeof str);
printf("ret %d, str '%s'", ret, str);
Expected behavior
ret 3, str 'abr'
Current behavior
ret 11, str 'ab'
gpci
To Reproduce
new str[3];// less than needed for serialnew ret = gpci(playerid, str, sizeof str);
printf("ret %d, str '%s'", ret, str);
Expected behavior
ret 3, str 'C44'
Current behavior
ret 40, str 'C4'
The text was updated successfully, but these errors were encountered:
NexiusTailer
changed the title
SHA256_PassHash returns wrong length for truncated string
Some natives return wrong length for truncated string
Apr 20, 2025
To be honest, I think a warning should be printed if the output string is truncated; I can't think of a scenario where it would make sense to purposely truncate the string. Certainly not for any of the functions listed above.
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
If the current behavior is not an intended thing, all the following natives:
should return the final actual length of a string if it was truncated.
SHA256_PassHash
To Reproduce
Expected behavior
Current behavior
GetPlayerIp
To Reproduce
Expected behavior
Current behavior
GetPlayerVersion
To Reproduce
Expected behavior
Current behavior
GetPlayerName
To Reproduce
Expected behavior
Current behavior
GetSVarString
To Reproduce
Expected behavior
Current behavior
GetPVarString
To Reproduce
Expected behavior
Current behavior
gpci
To Reproduce
Expected behavior
Current behavior
The text was updated successfully, but these errors were encountered: