
Pages:<< prev 1 next >>



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
so straight downloaded and compiled
remcon@RonniesPC:~/swfotefuss/src$ make make -s swr Compiling o/imc.o.... Compiling o/11.o.... Compiling o/act_comm.o.... Compiling o/act_info.o.... act_info.c: In function ‘void do_who(CHAR_DATA*, const char*)’: act_info.c:2503:60: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size between 2 and 4094 [-Wformat-truncation=] 2503 | snprintf( buf, MAX_STRING_LENGTH+2, "%s %s%s%s%s %s%s\n%s", | ^~ ...... 2507 | char_name, wch->pcdata->title, extra_title, clan_name, ch ? "\r" : "" ); | ~~~~~~~~~ act_info.c:2503:15: note: ‘snprintf’ output 6 or more bytes (assuming 5121) into a destination of size 4098 2503 | snprintf( buf, MAX_STRING_LENGTH+2, "%s %s%s%s%s %s%s\n%s", | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2504 | race, | ~~~~~ 2505 | invis_str, | ~~~~~~~~~~ 2506 | IS_SET( wch->act, PLR_AFK ) ? "[AFK]" : "", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2507 | char_name, wch->pcdata->title, extra_title, clan_name, ch ? "\r" : "" ); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Compiling o/act_move.o.... Compiling o/act_obj.o.... Compiling o/act_wiz.o.... Compiling o/boards.o.... Compiling o/bounty.o.... Compiling o/build.o.... Compiling o/clans.o.... Compiling o/color.o.... Compiling o/comm.o.... Compiling o/comments.o.... Compiling o/const.o.... Compiling o/db.o.... Compiling o/dns.o.... Compiling o/editor.o.... Compiling o/fight.o.... Compiling o/finfo.o.... Compiling o/force.o.... Compiling o/fskills.o.... Compiling o/functions.o.... Compiling o/handler.o.... Compiling o/hashstr.o.... Compiling o/hotboot.o.... Compiling o/hunter.o.... Compiling o/interp.o.... Compiling o/magic.o.... Compiling o/makeobjs.o.... Compiling o/marriage.o.... Compiling o/mccp.o.... Compiling o/misc.o.... Compiling o/mssp.o.... Compiling o/mud_comm.o.... Compiling o/mud_prog.o.... Compiling o/newarena.o.... newarena.c: In function ‘void show_jack_pot()’: newarena.c:485:12: warning: ‘snprintf’ argument 4 may overlap destination object ‘buf1’ [-Wrestrict] 485 | snprintf( buf1 + strlen( buf1 ), ( MAX_INPUT_LENGTH - strlen( buf1 ) ), "%sThe jack pot for this arena is %d credits\r\n", buf1, arena_pot ); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ newarena.c:482:9: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here 482 | char buf1[MAX_INPUT_LENGTH]; | ^~~~ newarena.c:486:12: warning: ‘snprintf’ argument 4 may overlap destination object ‘buf1’ [-Wrestrict] 486 | snprintf( buf1 + strlen( buf1 ), ( MAX_INPUT_LENGTH - strlen( buf1 ) ), "%s%d credits have been bet on this arena.\r\r\n\n", buf1, bet_pot ); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ newarena.c:482:9: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here 482 | char buf1[MAX_INPUT_LENGTH]; | ^~~~ newarena.c: In function ‘void do_awho(CHAR_DATA*, const char*)’: newarena.c:595:12: warning: ‘snprintf’ argument 4 may overlap destination object ‘buf’ [-Wrestrict] 595 | snprintf( buf + strlen( buf ), ( MAX_INPUT_LENGTH - strlen( buf ) ), "%s-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-", buf ); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ newarena.c:584:9: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here 584 | char buf[MAX_INPUT_LENGTH]; | ^~~ newarena.c:596:12: warning: ‘snprintf’ argument 4 may overlap destination object ‘buf’ [-Wrestrict] 596 | snprintf( buf + strlen( buf ), ( MAX_INPUT_LENGTH - strlen( buf ) ), "%s&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-\r\n", buf ); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ newarena.c:584:9: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here 584 | char buf[MAX_INPUT_LENGTH]; | ^~~ newarena.c:597:12: warning: ‘snprintf’ argument 4 may overlap destination object ‘buf’ [-Wrestrict] 597 | snprintf( buf + strlen( buf ), ( MAX_INPUT_LENGTH - strlen( buf ) ), "%sGame Length = &R%-3d &WTime To Start &R%-3d\r\n", buf, game_length, time_to_start ); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ newarena.c:584:9: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here 584 | char buf[MAX_INPUT_LENGTH]; | ^~~ newarena.c:598:12: warning: ‘snprintf’ argument 4 may overlap destination object ‘buf’ [-Wrestrict] 598 | snprintf( buf + strlen( buf ), ( MAX_INPUT_LENGTH - strlen( buf ) ), "%s&Wtop_level Limits &R%d &Wto &R%d\r\n", buf, lo_lim, hi_lim ); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ newarena.c:584:9: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here 584 | char buf[MAX_INPUT_LENGTH]; | ^~~ newarena.c:599:12: warning: ‘snprintf’ argument 4 may overlap destination object ‘buf’ [-Wrestrict] 599 | snprintf( buf + strlen( buf ), ( MAX_INPUT_LENGTH - strlen( buf ) ), "%s &WJackpot = &R%d\r\n", buf, arena_pot ); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ newarena.c:584:9: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here 584 | char buf[MAX_INPUT_LENGTH]; | ^~~ newarena.c:600:12: warning: ‘snprintf’ argument 4 may overlap destination object ‘buf’ [-Wrestrict] 600 | snprintf( buf + strlen( buf ), ( MAX_INPUT_LENGTH - strlen( buf ) ), "%s&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B", buf ); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ newarena.c:584:9: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here 584 | char buf[MAX_INPUT_LENGTH]; | ^~~ newarena.c:601:12: warning: ‘snprintf’ argument 4 may overlap destination object ‘buf’ [-Wrestrict] 601 | snprintf( buf + strlen( buf ), ( MAX_INPUT_LENGTH - strlen( buf ) ), "%s-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B-&W-&B\r\n", buf ); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ newarena.c:584:9: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here 584 | char buf[MAX_INPUT_LENGTH]; | ^~~ newarena.c: In function ‘void start_arena()’: newarena.c:320:21: warning: ‘snprintf’ argument 4 may overlap destination object ‘buf1’ [-Wrestrict] 320 | snprintf( buf1 + strlen( buf1 ), ( MAX_INPUT_LENGTH - strlen( buf1 ) ), "%s1 &Whour to start\r\n", buf1 ); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ newarena.c:291:9: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here 291 | char buf1[MAX_INPUT_LENGTH]; | ^~~~ newarena.c:321:21: warning: ‘snprintf’ argument 4 may overlap destination object ‘buf1’ [-Wrestrict] 321 | snprintf( buf1 + strlen( buf1 ), ( MAX_INPUT_LENGTH - strlen( buf1 ) ), "%s\r\nType &Rarena &Wto enter.\r\n", buf1 ); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ newarena.c:291:9: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here 291 | char buf1[MAX_INPUT_LENGTH]; | ^~~~ newarena.c:310:21: warning: ‘snprintf’ argument 4 may overlap destination object ‘buf1’ [-Wrestrict] 310 | snprintf( buf1 + strlen( buf1 ), ( MAX_INPUT_LENGTH - strlen( buf1 ) ), "%s%d &Whours to start\r\n", buf1, time_to_start ); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ newarena.c:291:9: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here 291 | char buf1[MAX_INPUT_LENGTH]; | ^~~~ newarena.c:311:21: warning: ‘snprintf’ argument 4 may overlap destination object ‘buf1’ [-Wrestrict] 311 | snprintf( buf1 + strlen( buf1 ), ( MAX_INPUT_LENGTH - strlen( buf1 ) ), "%s\r\nType &Rarena &Wto enter.\r\n", buf1 ); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ newarena.c:291:9: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here 291 | char buf1[MAX_INPUT_LENGTH]; | ^~~~ Compiling o/pfiles.o.... Compiling o/planets.o.... Compiling o/player.o.... Compiling o/reset.o.... Compiling o/save.o.... Compiling o/sha256.o.... Compiling o/ships.o.... Compiling o/shops.o.... Compiling o/skills.o.... Compiling o/slicers.o.... Compiling o/space.o.... Compiling o/special.o.... Compiling o/swskills.o.... Compiling o/tables.o.... Compiling o/track.o.... Compiling o/tech.o.... Compiling o/update.o.... -e Generating dependency file ... -e Done compiling mud. make -s dns -e Done compiling DNS resolver.


Black Hand

GroupAdministrators
Posts3,707
JoinedJan 1, 2002
Yep. I ignored all of that because I didn't know how to fix it and those statements have all been working fine.



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
its because they are putting the string into itself, just remove the %s and the buf its adding since its already doing that when it does the buf1 + strlen( buf1 ), ( MAX_INPUT_LENGTH - strlen( buf1 ) ). its about like its double copying it the way it is looking anyways lol. could also just use mudstrlcat for the strings its copying.



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
for example i changed
to this
if( time_to_start > 1 ) { snprintf( buf1, MAX_INPUT_LENGTH, "&WThe Killing Fields are open to top_levels &R%d &Wthru &R%d\r\n", lo_lim, hi_lim ); snprintf( buf1 + strlen( buf1 ), ( MAX_INPUT_LENGTH - strlen( buf1 ) ), "%s%d &Whours to start\r\n", buf1, time_to_start ); snprintf( buf1 + strlen( buf1 ), ( MAX_INPUT_LENGTH - strlen( buf1 ) ), "%s\r\nType &Rarena &Wto enter.\r\n", buf1 ); snprintf( buf, MAX_INPUT_LENGTH, "With just %d hours to go till the start of the arena %d people have accepted the challenge!\r\n", time_to_start, num_in_arena( ) ); sportschan( buf ); sportschan( buf1 ); } else { snprintf( buf1, MAX_INPUT_LENGTH, "&WThe Killing Fields are open to top_levels &R%d &Wthru &R%d\r\n", lo_lim, hi_lim ); snprintf( buf1 + strlen( buf1 ), ( MAX_INPUT_LENGTH - strlen( buf1 ) ), "%s1 &Whour to start\r\n", buf1 ); snprintf( buf1 + strlen( buf1 ), ( MAX_INPUT_LENGTH - strlen( buf1 ) ), "%s\r\nType &Rarena &Wto enter.\r\n", buf1 ); snprintf( buf, MAX_INPUT_LENGTH, "With just 1 hour to go till the start of the arena %d people have accepted the challenge!\r\n", num_in_arena( ) ); sportschan( buf ); sportschan( buf1 ); } snprintf( buf, MAX_INPUT_LENGTH, "&WThe arena has been opened. &R%d &Whour(s) to start.\r\n", time_to_start ); sportschan( buf );
to this
if( time_to_start > 1 ) { snprintf( buf1, sizeof( buf1 ), "&WThe Killing Fields are open to top_levels &R%d &Wthru &R%d\r\n", lo_lim, hi_lim ); snprintf( buf1 + strlen( buf1 ), ( sizeof( buf1 ) - strlen( buf1 ) ), "%d &Whours to start\r\n", time_to_start ); snprintf( buf1 + strlen( buf1 ), ( sizeof( buf1 ) - strlen( buf1 ) ), "%s", "\r\nType &Rarena &Wto enter.\r\n" ); snprintf( buf, sizeof( buf ), "With just %d hours to go till the start of the arena %d people have accepted the challenge!\r\n", time_to_start, num_in_arena( ) ); sportschan( buf ); sportschan( buf1 ); } else { snprintf( buf1, sizeof( buf1 ), "&WThe Killing Fields are open to top_levels &R%d &Wthru &R%d\r\n", lo_lim, hi_lim ); snprintf( buf1 + strlen( buf1 ), ( sizeof( buf1 ) - strlen( buf1 ) ), "%s", "1 &Whour to start\r\n" ); snprintf( buf1 + strlen( buf1 ), ( sizeof( buf1 ) - strlen( buf1 ) ), "%s", "\r\nType &Rarena &Wto enter.\r\n" ); snprintf( buf, sizeof( buf ), "With just 1 hour to go till the start of the arena %d people have accepted the challenge!\r\n", num_in_arena( ) ); sportschan( buf ); sportschan( buf1 ); }
Pages:<< prev 1 next >>