Strings messing up
#1

Hi,

this problem only recently popped up and happens randomly. Here is a rough example of what lately happened.
For some reason, after a few hours of server uptime:

Example script: (this is really just an example, it randomly pops up in many parts)
http://pastebin.com/VrYGm8RM
Normal out put is e.g. "Admins connected: Leonard_Nino[51], Mathieu_Lemmens[86], Adam_Cooper[100], Luigi_Tattaglia[113]"

Problem:
It kind of gets buggy after a few hours of uptime;
Output after a few hours of uptime: "Admins connected:Adam_Cooperam_Cooperam_Cooperam_Coop"
And it stays like this forever, doesn't matter how many times you use the command.

^ Once again, that is just a rough example, it happened it many commands.

No, it doesn't only happen with iEcho, but with every function e.g. SendClientMessage, ...
Adam_Cooper being a player name (which is offline). It really happens in random strings everywhere along the script and it always inputs player names or random formatted strings into strings. (Ok, quite bad explanation, but that's how it is.)

The server is running on a Debian Squeeze x64 OS.
The script is compiled on the Windows R5 server package.
The server is running on server R5. Also tested with R2, same random buggy string outputs.

Plugins used: sscanf (R5 version), g-stylezzz' mysql plugin (R6), incognito's IRC plugin, incognito's streamer.

EDIT: One more example happening right now;
Worked fine for a few hours = http://pastebin.com/UPqdQN6b
Starts messing up now: Leonardo_Delacosta being a random player name
Reply
#2

Looks like a wrong parameter on format. Let me look properly
Reply
#3

I remember you had that problem some weeks ago. How did you fixed that? It just came back?
Reply
#4

You mean me?

Edit: Nevermind

Anyway, I don't know the problem either - maybe it's a real SA:MP bug since it's mixing with offline players
Reply
#5

This generally is a result of a buffer overflow in your mode.
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
That sounds like a mode bug, not a SA:MP bug (as in, I'm basically telling you it's a mode bug). Firstly why are you using odd characters at the start and end of lines? Secondly are you CERTAIN you know what "PlayerName" is returning (given that you have NO print statements anywhere in this code)? Add more prints, many more prints.
That first command is an IRC plugin command which returns a proper-formatted message (bold, colours, ..) to IRC. In the second case you can see that the string is absolutely normally formatted.

I doubt printing stuff after PlayerName() is useless as it's really just the very basic function; http://pastebin.com/wSgRVFmV

edit:
@Jay: Oh damn, not that again. I also recently added the crashdetect plugin which unfortunately, so far, didn't report anything.
Reply
#7

The only thing I can see is the string size.
Since you put the whole string into 1 line, I think it's not enough when there's many admins.
In extreme case each admin will take up 29 characters in "%s[%d], ", for the maximum length of player name is 20 and the admin level has 5 digits.
The "7Admins connected: " takes up 23 characters (including the control characters).
When there're 5 admins the size is not enough.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)