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

Development::Bug Reports Post detailed bug reports and what you would like to see next in the emu here.

Reply
 
Thread Tools Display Modes
  #1  
Old 10-22-2008, 12:56 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

Code:
char *link;
sprintf(link, "%c%06X%s%s%c", ...
You are declaring link as a pointer to an array of characters, but not initialising it to a valid value, so it will point to a random position in memory.

You should declare it like char link[100]; (replacing 100 with whatever the maximum size of a link is).
Reply With Quote
  #2  
Old 10-22-2008, 01:05 PM
paaco
Discordant
 
Join Date: Jan 2005
Posts: 320
Default

I'm no coding genius, so this may not be helpful at all. But it appears to be the part that Derision just mentioned. This is what pops up while zone is compiling and it gets to that part.

1>c:\eq\eqemuserver\zone\playercorpse.cpp(1005) : warning C4700: uninitialized local variable 'link' used
Reply With Quote
  #3  
Old 10-22-2008, 01:53 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Quote:
Originally Posted by Derision View Post
You should declare it like char link[100]; (replacing 100 with whatever the maximum size of a link is).
My concern is that the link's length depends on the name of the item, since it is appended on the end, just before the terminating character 0x12. However, an item name should be a max of 64, so we could just set the length to 1+6+39+64+1 = 111.

I'll go ahead and compile the changes & see what happens.

Edit: we could use a string, like was done before, but it would be so much more of a pita to get it back to a predictable char.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki

Last edited by AndMetal; 10-22-2008 at 09:58 PM..
Reply With Quote
  #4  
Old 10-22-2008, 01:56 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

I'm not sure if your calculation include the `\0` terminator that sprintf will automatically put at the end of the string. If not, you should add 1 byte for that.
Reply With Quote
  #5  
Old 10-22-2008, 05:13 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

I started with 111 (didn't realize the last byte added by sprintf at the time) and it works fine, primarily because the longest item name in the DB is 50 characters long:
Code:
mysql> SELECT id, Name, CHAR_LENGTH(Name) as Name_length FROM items ORDER BY Name_length DESC, id ASC LIMIT 5;
+-------+----------------------------------------------------+-------------+
| id    | Name                                               | Name_length |
+-------+----------------------------------------------------+-------------+
| 18557 | Prophecy of Vah: A History of the Vah Shir Vol.III |          50 |
| 20429 | Banner Material Kit: Focus of Benefit Conservation |          50 |
| 18556 | Prophecy of Vah: A History of the Vah Shir Vol.II  |          49 |
| 46814 | Gnomework Model XVII's Experimental Plate Backing  |          49 |
| 57937 | First Sisters of the Blackfeather Harpies Vol. II  |          49 |
+-------+----------------------------------------------------+-------------+
5 rows in set (0.98 sec)
I'll get this updated into SVN once I have a chance to finish some other stuff (unless someone wants to take care of it first).
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #6  
Old 10-23-2008, 12:32 AM
paaco
Discordant
 
Join Date: Jan 2005
Posts: 320
Default

Thanks for the fix Andmetal, took care of the problem I was having. I can now loot with Rev 129
Reply With Quote
Reply


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 06:32 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