|
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Cheese Wow Cheese is so helpful!
Joined: Mar 18 2007 Posts: 1017 Offline
|
|
Back to top |
|
|
Snrrrub Novice
Joined: May 29 2008 Posts: 37 Offline
|
Posted: Thu Sep 11, 2008 11:57 am Post subject: |
|
|
|
|
There's an out-of-bounds array access when you do:
On the last iteration of the loop, you're accessing an array element one past the end of the supplied buffer which could result in a crash.
The "namebuf" should be at least 25 bytes long since client <--> game server protocol assumes names with a max length of 24.
The "incomingbuf" variable should be eliminated - it's not necessary since you're just copying "in_msg" into it.
I haven't looked at the entire thing to be completely honest but you don't need to set flags and have strange control flow (continue, break, loops, etc.) to make something like this work - instead you should probably use sscanf and you'll accomplish the same in just a few lines.
I'd post a solution here but then where's the fun in learning about sscanf?
-Snrrrub |
|
Back to top |
|
|
Cheese Wow Cheese is so helpful!
Joined: Mar 18 2007 Posts: 1017 Offline
|
Posted: Thu Sep 11, 2008 4:10 pm Post subject: |
|
|
|
|
well, this was written in mervbot initially, so ill keep [20] over [25] for awhile =P
also gonna keep incomingbuf, because its exclusively for debugging(commented out part)
why use sscanf if -2ez-? |
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Thu Sep 11, 2008 4:59 pm Post subject: |
|
|
|
|
Quote: | well, this was written in mervbot initially, so ill keep [20] over [25] for awhile =P | But incoming CHAT messages might not have the same format... you receive the whole name of the player, and its message. So if you send messages from the Event_Chat to there, it might go BOOM _________________ (Insert a bunch of dead links here) |
|
Back to top |
|
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Software by php BB © php BB Group Server Load: 674 page(s) served in previous 5 minutes.
|