copy_buffer
< Newer Topic
:: Older Topic >
Pages:<< prev 1 next >>
#1 Jan 6, 2025 6:18 pm
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]
#2 Jan 6, 2025 6:46 pm
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.
Then i inserted the lines where they were needed since copying it all didn't put in all the empty lines.
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.
#3 Jan 6, 2025 7:00 pm
Geomancer
GroupAdministrators
Posts1,988
JoinedJul 26, 2005
well changing
to
seems to have fixed it lol
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
#4 Jan 6, 2025 7:05 pm
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.
#5 Jan 6, 2025 10:24 pm
Black Hand
GroupAdministrators
Posts3,713
JoinedJan 1, 2002
Good to see the memory sanitization wasn't a wasted effort
Pages:<< prev 1 next >>