Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 05-22-2009, 04:25 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Quote:
Originally Posted by KLS View Post
This is at best a crash and at worse something far more dangerous.
*And by that she means the complete and total destruction of the universe. -editor
Reply With Quote
  #2  
Old 05-22-2009, 04:55 PM
Shendare
Dragon
 
Join Date: Apr 2009
Location: California
Posts: 814
Default

Ooh, yeah, some unstable referencing there.

Using char response[64]; instead of char* response; will solve the main problem by allocating 63 bytes for the phrase (plus one for the null terminator).

The second step would be changing strcpy() so that if someone gets funny and passes a phrase larger than 63 characters you won't be looking at a buffer overflow:

Code:
if (mysql_num_rows(result) == 1)
{
	row = mysql_fetch_row(result);
	strncpy_s(response, sizeof(response), row[0], _TRUNCATE);
}
Reply With Quote
  #3  
Old 05-22-2009, 05:13 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Yeah, Derision had already pointed out the Memory Allocation issue to me in a PM lol. I was gonna fix it on the next update I did. Simple fix anyway. And the code I posted here isn't the final code. I did add a sanity check to have it verify that they have a target before it tries to send the say message to the target. I will put the truncate in there too, thanks Shendare.

I was hoping for someone to review the code, but since it was already working and not a required feature by any means, I figured I would get what I had up there and add in any needed fixes later. Thanks for the info.

Edit: NM, I see KLS already got the mem allocation thing fixed. Thanks, KLS.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 05-23-2009 at 01:16 AM..
Reply With Quote
  #4  
Old 06-06-2009, 03:58 PM
Sion
Fire Beetle
 
Join Date: Jun 2008
Location: -
Posts: 14
Default

Is there any way to make it where when the player clicks a saylink, the npc they are talking to responds as if they said that but the player doesn't actually say anything?
Also, can you make the text you click on different than what is said/sent to npc?
Reply With Quote
  #5  
Old 06-06-2009, 06:30 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

You can't make the name of the link different than what is said when it gets clicked. But, if needed, you should be able to change what your script is waiting to be said so that it catches things however you want to say them. An example would be if your NPC said "bind your soul", most players would type "bind my soul", but if you clicked the link, it would say "bind your soul". In this example, you could just have the NPC look for either "bind" or "soul" to be said so that both phrases would work as replies.

It is possible to code it so the players don't actually say anything, but it may be better that they do. All we would have to do is do the parse of the text right there instead of sending the message as a say. It probably wouldn't be bad to do it that way, other than people maybe clicking the links to annoy people and no way to tell for sure who it is causing the spam.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #6  
Old 06-06-2009, 11:04 PM
Krugus
Sarnak
 
Join Date: Dec 2005
Location: the Void
Posts: 40
Default is this working?

Just wondering if saylink is working in the Branch version ?

I see the code for it there. Table in the DB is there but its not working for me when I follow the examples in this thread or the wikki you have linked hrmmm.

Just compiled ver 635 of the Instance Branch version today. Guess I'll take a look at the regular SVN and see if there is a difference in code for the saylink.
Reply With Quote
  #7  
Old 06-06-2009, 11:30 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Branch is no longer used, we're back on the trunk.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:56 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3