Login
User Name:

Password:



Register

Forgot your password?
 sting skill
Jan 7, 2025 7:32 pm
By Remcon
 south command
Jan 7, 2025 7:22 pm
By Remcon
 mphate
Jan 7, 2025 7:16 pm
By Remcon
 do_setliquid
Jan 7, 2025 3:22 pm
By Remcon
 Array overrun and incorrect string macros used in do_setclass
Jan 7, 2025 3:20 am
By Samson
Help.are for SmaugFUSS1.9.5
Author: Smaug
Submitted by: Remcon
LOP 1.6
Author: Remcon
Submitted by: Remcon
SWFOTEFUSS 1.5.1
Author: Various
Submitted by: Samson
SWRFUSS 1.4.1
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.5
Author: Various
Submitted by: Samson
Users Online
Anthropic, Bing, Google, Yandex

Members: 0
Guests: 12
Stats
Files
Topics
Posts
Members
Newest Member
495
3,819
19,758
589
ReubenKeat

» SmaugMuds » Codebases » SmaugFUSS » copy_buffer
Forum Rules | Mark all | Recent Posts

copy_buffer
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jan 6, 2025 6:18 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,988
JoinedJul 26, 2005

 
READ of size 1 at 0x7ffff5a2602f thread T0
    #0 0x55555581b3b7 in copy_buffer(char_data*) /home/remcon/smaugfuss/src/build.c:942
    #1 0x555555746e79 in do_hedit /home/remcon/smaugfuss/src/act_info.c:2347
    #2 0x55555584a216 in edit_buffer(char_data*, char*) /home/remcon/smaugfuss/src/build.c:5972
    #3 0x5555558b8c2c in game_loop() /home/remcon/smaugfuss/src/comm.c:866
    #4 0x5555558b673e in main /home/remcon/smaugfuss/src/comm.c:532
    #5 0x7ffff734d1c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #6 0x7ffff734d28a in __libc_start_main_impl ../csu/libc-start.c:360
    #7 0x5555556d4304 in _start (/home/remcon/smaugfuss/src/smaug+0x180304) (BuildId: 657f1af0db318fe0530f1eab9cf243d571f645fb)

Address 0x7ffff5a2602f is located in stack of thread T0 at offset 47 in frame
    #0 0x55555581b116 in copy_buffer(char_data*) /home/remcon/smaugfuss/src/build.c:920

  This frame has 2 object(s):
    [48, 148) 'tmp' (line 922) <== Memory access at offset 47 underflows this variable
    [192, 4288) 'buf' (line 921)
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-underflow /home/remcon/smaugfuss/src/build.c:942 in copy_buffer(char_data*)
Shadow bytes around the buggy address:
  0x7ffff5a25d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7ffff5a25e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7ffff5a25e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7ffff5a25f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7ffff5a25f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x7ffff5a26000: f1 f1 f1 f1 f1[f1]00 00 00 00 00 00 00 00 00 00
  0x7ffff5a26080: 00 00 04 f2 f2 f2 f2 f2 00 00 00 00 00 00 00 00
  0x7ffff5a26100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7ffff5a26180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7ffff5a26200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7ffff5a26280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==392==ABORTING
[Inferior 1 (process 392) exited with code 01]

Post is unread #2 Jan 6, 2025 6:46 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,988
JoinedJul 26, 2005

 
If you want to mess with it to find a fix heres the helpfile and stuff i did.
hedit homebuy

Syntax:  homebuy <argument>
 
Where the argument is one of:
 list
 show <# of auction item> 
 bid <# of auction item> <amount>

Using these commands you can determine which house you would like to purchase.
Inside the "homebuy list", an (a) next to the name of a house indicates that it
is an apartment.  Apartments differ from houses in that apartments can only be
one room and apartments do not save objects inside.
 
Sellers of houses not bid on will be charged up to a 20% gold penalty.
Bidders on houses that cannot support the bid by gold on their character at
time of sale will be charged up to a 20% penalty.  The house is then placed
back on auction.  Once the bid reaches maximum amount of gold possible to be
bid, the sale will be closed.
 
If you are the bidder or the seller and are not online at time of sale, your
gold will be adjusted automatically while you are offline.

&YNote: &wHouses may only be purchased by Avatars.
 
See Also:  HOUSE, SELLHOUSE, ACCESSORIES, HOUSING

Then i inserted the lines where they were needed since copying it all didn't put in all the empty lines.

Post is unread #3 Jan 6, 2025 7:00 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,988
JoinedJul 26, 2005

 
well changing
const char *copy_buffer( CHAR_DATA * ch )
{
   char buf[MAX_STRING_LENGTH];
   char tmp[100];
   short x, len;

   if( !ch )
   {
      bug( "%s: null ch", __func__ );
      return STRALLOC( "" );
   }

   if( !ch->editor )
   {
      bug( "%s: null editor", __func__ );
      return STRALLOC( "" );
   }

   buf[0] = '\0';
   for( x = 0; x < ch->editor->numlines; x++ )
   {
      mudstrlcpy( tmp, ch->editor->line[x], 100 );
      len = strlen( tmp );
      if( tmp[len - 1] == '~' )
         tmp[len - 1] = '\0';
      else
         mudstrlcat( tmp, "\n", 100 );
      smash_tilde( tmp );
      mudstrlcat( buf, tmp, MAX_STRING_LENGTH );
   }
   return STRALLOC( buf );
}

to
const char *copy_buffer( CHAR_DATA * ch )
{
   char buf[MAX_STRING_LENGTH];
   char tmp[100];
   short x, len;

   if( !ch )
   {
      bug( "%s: null ch", __func__ );
      return STRALLOC( "" );
   }

   if( !ch->editor )
   {
      bug( "%s: null editor", __func__ );
      return STRALLOC( "" );
   }

   buf[0] = '\0';
   for( x = 0; x < ch->editor->numlines; x++ )
   {
      mudstrlcpy( tmp, ch->editor->line[x], 100 );
      len = strlen( tmp );
      if( len > 0 && tmp[len - 1] == '~' )
         tmp[len - 1] = '\0';
      else
         mudstrlcat( tmp, "\n", 100 );
      smash_tilde( tmp );
      mudstrlcat( buf, tmp, MAX_STRING_LENGTH );
   }
   return STRALLOC( buf );
}

seems to have fixed it lol

Post is unread #4 Jan 6, 2025 7:05 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,988
JoinedJul 26, 2005

 
using /d 11 even though I only have 10 lines currently will delete line 10. If just 9 lines it will tell you 11 is out of range.

Post is unread #5 Jan 6, 2025 10:24 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,713
JoinedJan 1, 2002

 
Good to see the memory sanitization wasn't a wasted effort :P

Pages:<< prev 1 next >>