Quote:
Originally Posted by /^We(stie|z+[e|a
r)$/ ]
#strins buffer overflow
pawn Code:
new string[] = ":("; strins(string, ">", 0); print(string);
Isn't this a good thing? It gives you, as the coder, an idea on how to deal with strings, etc. For example, if there's part of a string missing (that you need), unintentional things *might* happen. I'd rather have a crash instead of unintentional behaviour.
|
I think crashing is undesirable, if you need the string to be valid then you will have some other method of checking it rather than hoping the script will crash if it's too long. Besides the function has a maxlength parameter, so you would expect it to not overflow.
pawn Code:
native bool: strins(string[], const substr[], pos, maxlength=sizeof string);
Consider something like
pawn Code:
strreplace(string, "1", "one");
which is better: the string being truncated, or the script crashing?
EDIT: oh god, why is this still here
pawn Code:
// Take Cover
if (strcmp("/hide", cmdtext, true, 3) == 0) {
LoopingAnim(playerid, "ped", "cower", 3.0, 1, 0, 0, 0, 0); // Taking Cover
return 1;
}